不等式の基本
不等式とは
「月収が30万円以上でないとローンは組めない」「体重が60kg未満なら健康体重の範囲内」——日常生活には「等しい」ではなく「大きい・小さい」という関係があふれています。これを数式で表すのが不等式です。
不等式は「等しくない」関係を表す式です。
x + 3 > 5 (xは5-3=2より大きい)
2x - 1 ≤ 7 (xは4以下)
-x < 2 (xは-2より大きい ← 注意!)
方程式との最大の違いは:
負の数で両辺を割る(または掛ける)と、不等号の向きが逆になる
不等号の種類
| 記号 | 意味 | 数直線での表し |
|---|---|---|
| より大きい | を含まない右側 | |
| 以上 | を含む右側 | |
| より小さい | を含まない左側 | |
| 以下 | を含む左側 |
数直線では「含む」を●(塗りつぶし)、「含まない」を○(空き)で表します——「その境界の点が解に入るかどうか」を一目でわかるように表現する工夫です。
1次不等式の解き方
基本的には方程式と同じ手順ですが、「負の数での除算・乗算で不等号が逆転する」ことに注意します。
例1:
2x > 7 - 3 ← 移項
2x > 4
x > 2 ← 2 (正) で割るので向き変わらず
解集合:、区間表記:
例2:
-3x ≤ -6
x ≥ 2 ← -3 (負) で割るので ≤ が ≥ に逆転!
解集合:、区間表記:
なぜ逆転するのか
「 は正しい。両辺を で割ると ?」——これは誤り。正しくは 。
想像してみてください——数直線上で「正の数を掛けると距離が伸びる(向き変わらず)」「負の数を掛けると鏡に映したように左右反転する」。数を2倍にしてもデカい方がデカいままですが、マイナスにすると「大きい数」が「より小さい位置(より左)」に来てしまいます。
不等式の性質まとめ
① a < b かつ b < c → a < c (推移律)
② a < b → a+c < b+c (両辺に同数加算)
③ a < b かつ c > 0 → ac < bc (正の数で乗算:向き同じ)
④ a < b かつ c < 0 → ac > bc (負の数で乗算:向き逆転)
⑤ 0 < a < b → a² < b², √a < √b (正の数の単調性)
連立不等式
「身長が150cm以上かつ180cm以下」——2つの条件を同時に満たす範囲を求めるのが連立不等式です。
例: かつ
2x - 1 < 5 → x < 3
3x + 2 > -1 → x > -1
両方を満たす:
数直線: と の間(両端を除く)——「2つの条件の重なり部分(共通部分)」を探すイメージです。
function loop() {
ctx.clearRect(0, 0, W, H);
var a = -3 + Math.round((mx / W) * 6); // a from -3 to 3
if (a === 0) a = 1;
var b = 1, c = 7;
// solve: ax + b < c → ax < c-b → x < (c-b)/a or x > (c-b)/a
var rhs = c - b;
var boundary = rhs / a;
var lessThan = a > 0; // if a>0, x < boundary; if a<0, reversed
ctx.fillStyle = '#94a3b8';
ctx.font = '15px monospace';
ctx.textAlign = 'center';
ctx.fillText('不等式:' + a + 'x + ' + b + ' < ' + c + ' を解く', W/2, 28);
ctx.fillStyle = '#e2e8f0';
ctx.font = '14px monospace';
ctx.fillText(a + 'x < ' + rhs, W/2, 56);
if (a > 0) {
ctx.fillText('x < ' + boundary.toFixed(2) + ' (正の数 ' + a + ' で割る → 向き変わらず)', W/2, 80);
} else {
ctx.fillText('x > ' + boundary.toFixed(2) + ' (負の数 ' + a + ' で割る → 向き逆転!)', W/2, 80);
ctx.fillStyle = '#ef4444';
ctx.font = '13px monospace';
ctx.fillText('← ここが要注意!', W/2, 98);
}
// Number line
var ny = 160;
var nx0 = 60, nx1 = W - 60;
var nrange = 12;
var nscale = (nx1 - nx0) / nrange;
var ncx = (nx0 + nx1) / 2;
ctx.strokeStyle = '#475569'; ctx.lineWidth = 2;
ctx.beginPath(); ctx.moveTo(nx0, ny); ctx.lineTo(nx1, ny); ctx.stroke();
// Ticks
for (var tick = -6; tick <= 6; tick++) {
var tx = ncx + tick * nscale;
ctx.beginPath(); ctx.moveTo(tx, ny-6); ctx.lineTo(tx, ny+6); ctx.stroke();
ctx.fillStyle = '#64748b'; ctx.font = '11px monospace'; ctx.textAlign = 'center';
ctx.fillText(tick, tx, ny + 18);
}
// Solution region
var bx = ncx + boundary * nscale;
bx = Math.max(nx0, Math.min(nx1, bx));
ctx.fillStyle = '#3b82f6';
ctx.globalAlpha = 0.35;
if (lessThan) {
ctx.fillRect(nx0, ny - 10, bx - nx0, 20);
} else {
ctx.fillRect(bx, ny - 10, nx1 - bx, 20);
}
ctx.globalAlpha = 1;
// Boundary point
ctx.strokeStyle = '#fbbf24'; ctx.lineWidth = 2.5;
ctx.beginPath();
ctx.arc(bx, ny, 7, 0, Math.PI*2);
ctx.stroke();
ctx.fillStyle = '#0d1117';
ctx.beginPath();
ctx.arc(bx, ny, 7, 0, Math.PI*2);
ctx.fill();
ctx.strokeStyle = '#fbbf24'; ctx.lineWidth = 2.5;
ctx.stroke();
ctx.fillStyle = '#fbbf24'; ctx.font = 'bold 13px monospace'; ctx.textAlign = 'center';
ctx.fillText(boundary.toFixed(2), bx, ny - 18);
ctx.fillStyle = '#93c5fd'; ctx.font = '13px monospace';
ctx.fillText(lessThan ? ('x < ' + boundary.toFixed(2)) : ('x > ' + boundary.toFixed(2)), W/2, 230);
ctx.fillStyle = '#64748b'; ctx.font = '12px monospace';
ctx.fillText('マウスで a を変える(現在 a = ' + a + ')', W/2, 250);
requestAnimationFrame(loop);
}
loop(); 文字係数の不等式
のような式では の符号によって場合分けが必要です——「 の符号がわからないと、解の向きが決まらない」からです。
これが不等式の問題で「場合分け」が頻出する理由です。
絶対値と不等式の基礎
は「 と の距離が 未満」を意味します——「 を中心に半径 の範囲内」という直感的なイメージです:
|x - a| < r ⟺ a - r < x < a + r
|x - a| > r ⟺ x < a-r または x > a+r
例:
→ ——「3から距離が2以内」なので1から5の間です。
これは第13回でさらに詳しく扱います。
function loop() {
ctx.clearRect(0, 0, W, H);
var upper = -3 + (mx / W) * 10; // upper bound from -3 to 7
var lower = -1;
ctx.fillStyle = '#94a3b8'; ctx.font = '15px monospace'; ctx.textAlign = 'center';
ctx.fillText('連立不等式:x > ' + lower.toFixed(1) + ' かつ x < ' + upper.toFixed(2), W/2, 28);
var ny = 120;
var nx0 = 60, nx1 = W - 60;
var nrange = 12, nscale = (nx1-nx0)/nrange;
var ncx = (nx0+nx1)/2;
ctx.strokeStyle = '#475569'; ctx.lineWidth = 2;
ctx.beginPath(); ctx.moveTo(nx0, ny); ctx.lineTo(nx1, ny); ctx.stroke();
for (var tick = -6; tick <= 6; tick++) {
var tx = ncx + tick * nscale;
ctx.beginPath(); ctx.moveTo(tx,ny-5); ctx.lineTo(tx,ny+5); ctx.stroke();
ctx.fillStyle = '#64748b'; ctx.font='11px monospace'; ctx.textAlign='center';
ctx.fillText(tick, tx, ny+18);
}
// Condition 1: x > lower (blue)
var lx = Math.max(nx0, ncx + lower*nscale);
ctx.fillStyle = '#3b82f6'; ctx.globalAlpha = 0.3;
ctx.fillRect(lx, ny-16, nx1-lx, 12);
ctx.globalAlpha = 1;
// Condition 2: x < upper (green)
var ux = Math.min(nx1, ncx + upper*nscale);
ctx.fillStyle = '#22c55e'; ctx.globalAlpha = 0.3;
ctx.fillRect(nx0, ny+4, ux-nx0, 12);
ctx.globalAlpha = 1;
// Intersection
if (upper > lower) {
ctx.fillStyle = '#f59e0b'; ctx.globalAlpha = 0.7;
ctx.fillRect(lx, ny-4, ux-lx, 8);
ctx.globalAlpha = 1;
ctx.fillStyle = '#fbbf24'; ctx.font='13px monospace'; ctx.textAlign='center';
ctx.fillText('共通部分:' + lower.toFixed(1) + ' < x < ' + upper.toFixed(2), W/2, 175);
} else {
ctx.fillStyle = '#ef4444'; ctx.font='13px monospace'; ctx.textAlign='center';
ctx.fillText('共通部分なし(解なし)', W/2, 175);
}
// Boundary points
ctx.strokeStyle = '#3b82f6'; ctx.lineWidth = 2;
ctx.beginPath(); ctx.arc(lx, ny, 5, 0, Math.PI*2); ctx.stroke();
ctx.fillStyle = '#0d1117'; ctx.beginPath(); ctx.arc(lx, ny, 5, 0, Math.PI*2); ctx.fill();
ctx.strokeStyle = '#3b82f6'; ctx.stroke();
ctx.strokeStyle = '#22c55e'; ctx.lineWidth = 2;
ctx.beginPath(); ctx.arc(ux, ny, 5, 0, Math.PI*2); ctx.stroke();
ctx.fillStyle = '#0d1117'; ctx.beginPath(); ctx.arc(ux, ny, 5, 0, Math.PI*2); ctx.fill();
ctx.strokeStyle = '#22c55e'; ctx.stroke();
ctx.fillStyle = '#93c5fd'; ctx.font='12px monospace'; ctx.textAlign='left';
ctx.fillText('青: x > ' + lower, 60, 210);
ctx.fillStyle = '#86efac';
ctx.fillText('緑: x < ' + upper.toFixed(2), 60, 228);
ctx.fillStyle = '#fbbf24';
ctx.fillText('橙: 共通部分', 220, 210);
ctx.fillStyle = '#64748b'; ctx.textAlign='right';
ctx.fillText('マウスで上限を変える', W-20, 228);
requestAnimationFrame(loop);
}
loop(); まとめ
- 不等式は方程式とほぼ同じ手順で解く——「移項して整理する」手順は同じ
- 負の数で割る(掛ける)と不等号が逆向きになる——「数直線上で左右が反転する」から
- 解は数直線上の区間として表す(端点を含むか否かに注意)——「●か○か」が大事
- 連立不等式は各不等式の解集合の共通部分——「両方の条件を同時に満たす範囲」
- 文字係数がある場合は符号で場合分けが必要——「 がプラスかマイナスかで答えが変わる」
次回は2次不等式を扱います。放物線の形と「上か下か」の判断が鍵です。