絶対値を含む方程式・不等式
絶対値の定義
「東京から大阪まで何キロ?」——この距離は「マイナス500km」とは言いません。距離は常に0以上です。絶対値はこの「距離」の感覚を数式で表したものです。
絶対値は数直線上の原点からの距離です。そして は、点 からの距離を表します。
|5| = 5
|-3| = 3
|x - 3| = "x と 3 の距離"
この「距離」としての解釈がすべての問題の出発点です——「式の計算」ではなく「地図上の距離探し」だと思うと、解法が見えてきます。
絶対値方程式
基本形:()
「 からの距離が 」を満たす を求めます。距離が になる点は、 の左側と右側の2か所です。
|x - a| = b ⟺ x - a = b または x - a = -b
⟺ x = a + b または x = a - b
例:
「3から距離2の点」——数直線上で3から2進んだ点は5か1です。
x - 3 = 2 → x = 5
x - 3 = -2 → x = 1
解: または
例:
2x + 1 = 5 → x = 2
2x + 1 = -5 → x = -3
例:
両辺が等しい → 2つのケース:
x - 2 = x + 4 → -2 = 4 (矛盾・解なし)
x - 2 = -(x+4) → 2x = -2 → x = -1
解:(-2と4の中点)——「両点からの距離が等しい点は、中点」という感覚とも一致します。
絶対値不等式
()
「 からの距離が 未満」—— を中心に半径 の範囲内です。
|x - a| < r ⟺ a - r < x < a + r
()
「 からの距離が より大」—— から より遠い場所、つまり中心から外側の2つの領域です。
|x - a| > r ⟺ x < a - r または x > a + r
var r = 2.5;
function loop() {
ctx.clearRect(0, 0, W, H);
var a = -4 + (mx / W) * 10;
ctx.fillStyle = '#94a3b8'; ctx.font = '15px monospace'; ctx.textAlign = 'center';
ctx.fillText('|x − ' + a.toFixed(1) + '| < ' + r + ' の解', W/2, 26);
ctx.fillStyle = '#e2e8f0'; ctx.font = '13px monospace';
ctx.fillText('' + (a-r).toFixed(1) + ' < x < ' + (a+r).toFixed(1), W/2, 48);
var ny = 130, nx0=60, nx1=W-60, nrange=12, nscale=(nx1-nx0)/nrange, 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);
}
// Solution region
var lx = Math.max(nx0, ncx+(a-r)*nscale);
var rx = Math.min(nx1, ncx+(a+r)*nscale);
ctx.fillStyle='#3b82f6'; ctx.globalAlpha=0.4;
ctx.fillRect(lx, ny-12, rx-lx, 24);
ctx.globalAlpha=1;
// Center point a
var ax = ncx + a*nscale;
ctx.fillStyle='#fbbf24';
ctx.beginPath(); ctx.arc(ax, ny, 7, 0, Math.PI*2); ctx.fill();
ctx.fillStyle='#fde68a'; ctx.font='bold 12px monospace'; ctx.textAlign='center';
ctx.fillText('a=' + a.toFixed(1), ax, ny-18);
// Distance arrows
ctx.strokeStyle='#ef4444'; ctx.lineWidth=1.5;
ctx.setLineDash([3,3]);
ctx.beginPath(); ctx.moveTo(ax, ny-30); ctx.lineTo(lx, ny-30); ctx.stroke();
ctx.beginPath(); ctx.moveTo(ax, ny-30); ctx.lineTo(rx, ny-30); ctx.stroke();
ctx.setLineDash([]);
ctx.fillStyle='#ef4444'; ctx.font='12px monospace'; ctx.textAlign='center';
ctx.fillText('r=' + r, (ax+lx)/2, ny-42);
ctx.fillText('r=' + r, (ax+rx)/2, ny-42);
// Boundary open circles
ctx.strokeStyle='#93c5fd'; 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='#93c5fd'; ctx.stroke();
ctx.beginPath(); ctx.arc(rx, ny, 5, 0, Math.PI*2); ctx.stroke();
ctx.fillStyle='#0d1117'; ctx.beginPath(); ctx.arc(rx, ny, 5, 0, Math.PI*2); ctx.fill();
ctx.strokeStyle='#93c5fd'; ctx.stroke();
ctx.fillStyle='#93c5fd'; ctx.font='12px monospace'; ctx.textAlign='left';
ctx.fillText((a-r).toFixed(1), lx-16, ny+32);
ctx.fillStyle='#93c5fd'; ctx.textAlign='right';
ctx.fillText((a+r).toFixed(1), rx+16, ny+32);
ctx.fillStyle='#64748b'; ctx.font='12px monospace'; ctx.textAlign='center';
ctx.fillText('マウスで a を動かす(r = ' + r + ' 固定)', W/2, 230);
requestAnimationFrame(loop);
}
loop(); 場合分けによる解法
絶対値を含む式は、中身の符号で場合分けします——「 がどの値のとき、絶対値の中がプラスかマイナスか」を考えます。
例:
分岐点は と 。3つの範囲に分けます:
場合1: のとき(どちらも中身がマイナス)
→ → ✓( を満たす)
場合2: のとき(左はプラス、右はマイナス)
→ → 矛盾(解なし)
場合3: のとき(どちらも中身がプラス)
→ → ✓
解: または
三角不等式
これを三角不等式と言います。等号成立は と が同符号(または一方が0)のとき。
幾何学的意味
「2辺の和は1辺より長い(または等しい)」——三角形の法則そのものです。まっすぐ行くより、寄り道すると距離が伸びます。
複素数(またはベクトル)でも同様:
よく使う形
|a| - |b| ≤ |a - b| ≤ |a| + |b|
||a| - |b|| ≤ |a - b|
var pa = -2, pb = 2;
function loop() {
ctx.clearRect(0, 0, W, H);
var x = -5 + (mx/W)*10;
var sumDist = Math.abs(x - pa) + Math.abs(x - pb);
var minDist = Math.abs(pa - pb);
ctx.fillStyle='#94a3b8'; ctx.font='14px monospace'; ctx.textAlign='center';
ctx.fillText('|x - a| + |x - b| の最小値を確認', W/2, 26);
ctx.fillText('a = ' + pa + ', b = ' + pb + ', x = ' + x.toFixed(2), W/2, 46);
var ny=130, nx0=60, nx1=W-60, nrange=12, nscale=(nx1-nx0)/nrange, 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);
}
// Points a and b
var pax=ncx+pa*nscale, pbx=ncx+pb*nscale, xx=ncx+x*nscale;
ctx.fillStyle='#3b82f6';
ctx.beginPath(); ctx.arc(pax,ny,7,0,Math.PI*2); ctx.fill();
ctx.fillStyle='#93c5fd'; ctx.font='bold 13px monospace'; ctx.textAlign='center';
ctx.fillText('a', pax, ny-16);
ctx.fillStyle='#ef4444';
ctx.beginPath(); ctx.arc(pbx,ny,7,0,Math.PI*2); ctx.fill();
ctx.fillStyle='#fca5a5'; ctx.font='bold 13px monospace'; ctx.textAlign='center';
ctx.fillText('b', pbx, ny-16);
// x point
ctx.fillStyle='#fbbf24';
ctx.beginPath(); ctx.arc(xx,ny,7,0,Math.PI*2); ctx.fill();
ctx.fillStyle='#fde68a'; ctx.font='bold 13px monospace';
ctx.fillText('x', xx, ny-16);
// Distance lines
ctx.strokeStyle='#3b82f6'; ctx.lineWidth=2;
ctx.beginPath(); ctx.moveTo(xx, ny+28); ctx.lineTo(pax, ny+28); ctx.stroke();
ctx.fillStyle='#93c5fd'; ctx.font='12px monospace'; ctx.textAlign='center';
ctx.fillText(Math.abs(x-pa).toFixed(2), (xx+pax)/2, ny+44);
ctx.strokeStyle='#ef4444'; ctx.lineWidth=2;
ctx.beginPath(); ctx.moveTo(xx, ny+52); ctx.lineTo(pbx, ny+52); ctx.stroke();
ctx.fillStyle='#fca5a5'; ctx.font='12px monospace'; ctx.textAlign='center';
ctx.fillText(Math.abs(x-pb).toFixed(2), (xx+pbx)/2, ny+68);
var isMin = x >= pa && x <= pb;
ctx.fillStyle = isMin ? '#22c55e' : '#f59e0b';
ctx.font='bold 14px monospace'; ctx.textAlign='center';
ctx.fillText('合計 = ' + sumDist.toFixed(2) + ' 最小値 = ' + minDist + (isMin ? ' ✓最小!' : ''), W/2, 225);
ctx.fillStyle='#64748b'; ctx.font='12px monospace';
ctx.fillText('x が a と b の間にあるとき最小値 |a-b| = ' + minDist + ' を達成', W/2, 245);
requestAnimationFrame(loop);
}
loop(); 絶対値を含む不等式:練習
-
→ ——「4から距離3以内」
-
→ または ——「距離5以上の外側」
-
場合分け(、、)で解くと
まとめ
- = 「 からの距離」→ これが問題を解く最大の視点——「計算式ではなく距離の問題」
- → ( の周囲の区間)——「中心から半径 の内側」
- → または (外側の領域)——「中心から半径 の外側」
- 複雑な式は分岐点で場合分けして各区間で解く——「絶対値の中身がどこでプラス・マイナスが変わるか」
- 三角不等式 は頻出——「寄り道すると距離が伸びる」
次回は二項定理とパスカルの三角形を学びます。第1回で登場した の係数パターンの深い構造が明らかになります。