#15 ふれてみよう高校数学 関数
関数と方程式・不等式
グラフと方程式の関係
「 を解け」——これを純粋に代数で解くこともできますが、「 というグラフと という直線が交わる場所」と考えると、答えが視覚的に見えてきます。
方程式 の解は、 と の交点の 座標です。
グラフを描くことで:
- 解の個数が視覚的にわかる——「交点が2個なら解が2つ」
- 解のおおよその値(概算)がわかる——「交点の 座標を読み取る」
- 解が存在しない場合(交点なし)もすぐわかる——「グラフが重ならなければ解なし」
グラフと不等式の関係
「どちらのグラフが上にあるか?」——不等式の解はこれだけです。
不等式 の解は、 のグラフが のグラフより上にある の範囲です。
これを「 として を解く」と読み替えることもできます——「差が正になる区間」を探す、という見方です。
インタラクティブデモ:2曲線の交点と不等式領域
(青の放物線)と (オレンジの直線)を描画します。マウスを左右に動かすと、現在の 値での2つの関数値が比較され、 の領域(緑)と の領域(赤)が色で表示されます。黄色の点(交点)を境に色が変わるのを確認してください。
交点が方程式の解。上下の色分けが不等式の解の範囲
function loop() {
ctx.clearRect(0, 0, W, H);
var ox = W / 2, oy = H / 2 + 40;
var scale = 55;
var xVal = (mx / W) * 8 - 4;
function toScreen(x, y) {
return { sx: ox + x * scale, sy: oy - y * scale };
}
function f(x) { return x * x - 2; } // parabola
function g(x) { return x + 1; } // line
// Intersection: x^2 - 2 = x + 1 => x^2 - x - 3 = 0
// x = (1 ± sqrt(13)) / 2
var disc = 1 + 12;
var x1int = (1 - Math.sqrt(disc)) / 2; // ≈ -1.303
var x2int = (1 + Math.sqrt(disc)) / 2; // ≈ 2.303
// Grid
ctx.strokeStyle = 'rgba(255,255,255,0.06)';
ctx.lineWidth = 1;
for (var gx = -5; gx <= 5; gx++) {
var gs = toScreen(gx, 0);
ctx.beginPath(); ctx.moveTo(gs.sx, 0); ctx.lineTo(gs.sx, H); ctx.stroke();
}
for (var gy = -3; gy <= 5; gy++) {
var gs2 = toScreen(0, gy);
ctx.beginPath(); ctx.moveTo(0, gs2.sy); ctx.lineTo(W, gs2.sy); ctx.stroke();
}
// Shade region where f(x) < g(x) (between intersections) — green (parabola below line)
ctx.fillStyle = 'rgba(102,187,106,0.15)';
ctx.beginPath();
var s1s = toScreen(x1int, g(x1int));
ctx.moveTo(s1s.sx, s1s.sy);
for (var xi = x1int; xi <= x2int; xi += 0.03) {
var sg = toScreen(xi, g(xi));
ctx.lineTo(sg.sx, sg.sy);
}
var s2s = toScreen(x2int, f(x2int));
ctx.lineTo(s2s.sx, s2s.sy);
for (var xi2 = x2int; xi2 >= x1int; xi2 -= 0.03) {
var sf = toScreen(xi2, f(xi2));
ctx.lineTo(sf.sx, sf.sy);
}
ctx.closePath();
ctx.fill();
ctx.fillStyle = 'rgba(102,187,106,0.6)';
ctx.font = '12px sans-serif';
ctx.fillText('f < g の領域', toScreen(0.5, 0.5).sx, toScreen(0.5, 0.5).sy);
// Axes
ctx.strokeStyle = 'rgba(255,255,255,0.3)';
ctx.lineWidth = 1.5;
ctx.beginPath(); ctx.moveTo(0, oy); ctx.lineTo(W, oy); ctx.stroke();
ctx.beginPath(); ctx.moveTo(ox, 0); ctx.lineTo(ox, H); ctx.stroke();
// Axis labels
ctx.fillStyle = 'rgba(255,255,255,0.4)';
ctx.font = '12px sans-serif';
for (var lx = -4; lx <= 4; lx++) {
if (lx === 0) continue;
var ls = toScreen(lx, 0);
ctx.fillText(lx, ls.sx - 4, oy + 16);
}
for (var ly = -2; ly <= 4; ly++) {
if (ly === 0) continue;
var ls2 = toScreen(0, ly);
ctx.fillText(ly, ox + 5, ls2.sy + 4);
}
// g(x) = x+1 line (orange)
ctx.strokeStyle = '#ffb74d';
ctx.lineWidth = 2.5;
ctx.beginPath();
var sG1 = toScreen(-4, g(-4)), sG2 = toScreen(4, g(4));
ctx.moveTo(sG1.sx, sG1.sy); ctx.lineTo(sG2.sx, sG2.sy); ctx.stroke();
ctx.fillStyle = '#ffb74d';
ctx.font = 'bold 13px sans-serif';
ctx.fillText('y = x + 1', toScreen(2.5, 4.2).sx, toScreen(2.5, 4.2).sy);
// f(x) = x^2 - 2 parabola (blue)
ctx.strokeStyle = '#4fc3f7';
ctx.lineWidth = 2.5;
ctx.beginPath();
var stF = false;
for (var xi3 = -4; xi3 <= 4; xi3 += 0.03) {
var yi3 = f(xi3);
if (Math.abs(yi3) > 6) { stF = false; continue; }
var sF = toScreen(xi3, yi3);
if (!stF) { ctx.moveTo(sF.sx, sF.sy); stF = true; } else ctx.lineTo(sF.sx, sF.sy);
}
ctx.stroke();
ctx.fillStyle = '#4fc3f7';
ctx.font = 'bold 13px sans-serif';
ctx.fillText('y = x² - 2', toScreen(2.2, 5.5).sx, toScreen(2.2, 5.5).sy);
// Intersection points
var si1 = toScreen(x1int, g(x1int));
var si2 = toScreen(x2int, g(x2int));
ctx.fillStyle = '#ffeb3b';
ctx.beginPath(); ctx.arc(si1.sx, si1.sy, 7, 0, Math.PI*2); ctx.fill();
ctx.beginPath(); ctx.arc(si2.sx, si2.sy, 7, 0, Math.PI*2); ctx.fill();
ctx.fillStyle = '#ffeb3b';
ctx.font = '12px sans-serif';
ctx.fillText('(' + x1int.toFixed(2) + ', ' + g(x1int).toFixed(2) + ')', si1.sx - 60, si1.sy - 12);
ctx.fillText('(' + x2int.toFixed(2) + ', ' + g(x2int).toFixed(2) + ')', si2.sx + 8, si2.sy - 12);
// Vertical scan line
var xCl = Math.max(-3.5, Math.min(3.5, xVal));
var scanSx = toScreen(xCl, 0).sx;
ctx.strokeStyle = 'rgba(255,235,59,0.4)';
ctx.lineWidth = 1;
ctx.setLineDash([4,3]);
ctx.beginPath(); ctx.moveTo(scanSx, 0); ctx.lineTo(scanSx, H); ctx.stroke();
ctx.setLineDash([]);
// Points on curves at xCl
var fV = f(xCl), gV = g(xCl);
if (Math.abs(fV) <= 6) {
var pF = toScreen(xCl, fV);
ctx.fillStyle = '#4fc3f7';
ctx.beginPath(); ctx.arc(pF.sx, pF.sy, 5, 0, Math.PI*2); ctx.fill();
}
var pG = toScreen(xCl, gV);
ctx.fillStyle = '#ffb74d';
ctx.beginPath(); ctx.arc(pG.sx, pG.sy, 5, 0, Math.PI*2); ctx.fill();
// Info panel
ctx.fillStyle = 'rgba(0,0,0,0.7)';
ctx.beginPath(); ctx.roundRect(10, 10, 270, 110, 8); ctx.fill();
ctx.fillStyle = '#ffeb3b';
ctx.font = 'bold 13px monospace';
ctx.fillText('x = ' + xCl.toFixed(2), 18, 32);
ctx.fillStyle = '#4fc3f7';
ctx.font = '13px monospace';
ctx.fillText('f(x) = x²-2 = ' + fV.toFixed(2), 18, 52);
ctx.fillStyle = '#ffb74d';
ctx.fillText('g(x) = x+1 = ' + gV.toFixed(2), 18, 70);
var rel = fV > gV ? 'f(x) > g(x)' : fV < gV ? 'f(x) < g(x)' : 'f(x) = g(x)';
var relColor = fV > gV ? '#ef5350' : (fV < gV ? '#66bb6a' : '#ffeb3b');
ctx.fillStyle = relColor;
ctx.font = 'bold 14px sans-serif';
ctx.fillText(rel, 18, 90);
ctx.fillStyle = 'rgba(255,255,255,0.6)';
ctx.font = '11px sans-serif';
ctx.fillText('交点: x ≈ ' + x1int.toFixed(3) + ', ' + x2int.toFixed(3), 18, 108);
requestAnimationFrame(loop);
}
loop(); 代数的な解法
を解く
「2つのグラフが交わる場所を代数で求める」——右辺を左辺に移項して0と比較します。
交点: および
不等式 を解く
「放物線が直線の下にある区間」——交点を求めてから、放物線の形を考えます。
→
を解く。
の零点が なので、放物線(下に凸)が より小さいのは:
これはグラフで「直線が放物線より上にある区間」と一致します——「代数の答えがグラフの見た目と一致する」のを確認する習慣が大切です。
よく使う解法パターン
パターン①:2次不等式
の解——「放物線の形と判別式で場合分けする」:
- の場合、2根 として:
- : または (谷型の外側)
- :(山型の内側)
- の場合、重根 として:
- : の全実数( のとき )
- の場合:
- :全実数(放物線が全部 軸より上)
- :解なし(放物線が全部 軸より下)
パターン②:グラフで考える(不等式の解)
→ が より上にある の範囲——「直線を引いて放物線のどちら側かを見る」
→ または
練習問題
- を解け。
- を解け。
- と の交点を求め、 を解け。
- を解け。
解答
- →
- → または
- → → 交点 。不等式の解:
- →
シリーズのまとめ
このシリーズ「関数」では、以下のトピックを学びました:
| 回 | テーマ |
|---|---|
| 1–3 | 二次関数(グラフ、最大・最小、判別式) |
| 4–8 | 三角関数(定義、グラフ、加法・倍角・合成) |
| 9–11 | 指数・対数関数(定義、方程式・不等式) |
| 12–14 | 関数の理論(合成・逆関数、分数・無理関数、変換) |
| 15 | 関数とグラフ(方程式・不等式への応用) |
グラフを描いて視覚的に考える習慣が、関数の理解を深める最大の近道です——「式を解くだけでなく、グラフで確認する」という二段構えの思考が数学的直感を育てます。
まとめ
- 交点の個数は判別式で事前チェック可能——「計算前にグラフの形を想像する」
- グラフ上で不等式の解が「色で塗られた領域」として確認できる——「視覚で確かめてから代数で証明する」