関数のグラフ変換
グラフ変換の基本一覧
「 のグラフを右に2つ、上に3つ動かすと?」——グラフ変換とは、知っているグラフを「動かす・裏返す・伸び縮みさせる」操作です。一つの式を覚えれば、その変形パターンをすべて理解できます。
を基準としたとき:
| 変換 | グラフの移動 |
|---|---|
| 方向に (右に )移動 | |
| 方向に (上に )移動 | |
| 軸に関して対称移動 | |
| 軸に関して対称移動 | |
| 方向に に圧縮 | |
| 方向に 倍に拡大 | |
| 軸の下部を折り返し | |
| 軸の左部を折り返し |
重要な注意点
で のとき、グラフは右に 移動します( から を引くと右方向という点が紛らわしいので注意)。
「マイナスなのに右に動く」——直感と逆に思えますが、こう考えてください:「 になるのはどの か?」→ 、つまり元より だけ右の場所です。
確認方法: になるのは 、つまり元の よりも が だけ大きい位置。
インタラクティブデモ: の各種変換
マウスを左右に動かすと、変換のパラメータが変わります。基準関数 (薄い白)と変換後のグラフ(明るい色)を比較してください——青い放物線の頂点がマウスの位置に合わせて左右に動くのが、「横移動」の視覚的な確認になります。
function loop() {
ctx.clearRect(0, 0, W, H);
var ox = W / 2, oy = H / 2 + 20;
var scale = 45;
var t = (mx / W) * 4 - 2;
function toScreen(x, y) {
return { sx: ox + x * scale, sy: oy - y * scale };
}
// Grid
ctx.strokeStyle = 'rgba(255,255,255,0.06)';
ctx.lineWidth = 1;
for (var gx = -6; gx <= 6; gx++) {
var gs = toScreen(gx, 0);
ctx.beginPath(); ctx.moveTo(gs.sx, 0); ctx.lineTo(gs.sx, H); ctx.stroke();
}
for (var gy = -2; gy <= 5; gy++) {
var gs2 = toScreen(0, gy);
ctx.beginPath(); ctx.moveTo(0, gs2.sy); ctx.lineTo(W, gs2.sy); ctx.stroke();
}
// 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.35)';
ctx.font = '11px sans-serif';
for (var lx = -5; lx <= 5; lx++) {
if (lx === 0) continue;
var ls = toScreen(lx, 0);
ctx.fillText(lx, ls.sx - 4, oy + 14);
}
for (var ly = -1; ly <= 4; ly++) {
if (ly === 0) continue;
var ls2 = toScreen(0, ly);
ctx.fillText(ly, ox + 4, ls2.sy + 4);
}
// Base function y=x^2 (dim white)
ctx.strokeStyle = 'rgba(255,255,255,0.2)';
ctx.lineWidth = 1.5;
ctx.beginPath();
var stB = false;
for (var xi = -6; xi <= 6; xi += 0.04) {
var yi = xi * xi;
if (yi > 6) { stB = false; continue; }
var s = toScreen(xi, yi);
if (!stB) { ctx.moveTo(s.sx, s.sy); stB = true; } else ctx.lineTo(s.sx, s.sy);
}
ctx.stroke();
function drawCurve(fn, color, lineWidth) {
ctx.strokeStyle = color;
ctx.lineWidth = lineWidth || 2.5;
ctx.beginPath();
var st = false;
for (var xi = -6; xi <= 6; xi += 0.04) {
var yi = fn(xi);
if (isNaN(yi) || Math.abs(yi) > 6) { st = false; continue; }
var s = toScreen(xi, yi);
if (!st) { ctx.moveTo(s.sx, s.sy); st = true; } else ctx.lineTo(s.sx, s.sy);
}
ctx.stroke();
}
// Transformation 1: y = (x-t)^2 — horizontal shift
drawCurve(function(x) { return (x - t) * (x - t); }, '#4fc3f7');
// Transformation 2: y = x^2 + t — vertical shift
drawCurve(function(x) { return x * x + t; }, '#ff8a65');
// Transformation 3: y = |x^2 - 1| — absolute value
drawCurve(function(x) { return Math.abs(x * x - 1); }, '#66bb6a');
// Transformation 4: y = (-x)^2 = x^2 (same for parabola), show y=-x^2 instead
drawCurve(function(x) { return -(x * x); }, '#ef5350');
// Vertices
var v1 = toScreen(t, 0);
var v2 = toScreen(0, t);
ctx.fillStyle = '#4fc3f7';
ctx.beginPath(); ctx.arc(v1.sx, v1.sy, 5, 0, Math.PI*2); ctx.fill();
ctx.fillStyle = '#ff8a65';
if (Math.abs(t) <= 5) {
ctx.beginPath(); ctx.arc(v2.sx, v2.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, 120, 8); ctx.fill();
ctx.fillStyle = 'rgba(255,255,255,0.4)';
ctx.font = '12px sans-serif';
ctx.fillText('基準: y = x²', 18, 30);
ctx.fillStyle = '#4fc3f7'; ctx.font = 'bold 13px monospace';
ctx.fillText('y = (x - ' + t.toFixed(1) + ')²', 18, 52);
ctx.fillStyle = 'rgba(79,195,247,0.6)'; ctx.font = '11px sans-serif';
ctx.fillText('横方向に ' + t.toFixed(1) + ' 移動', 18, 66);
ctx.fillStyle = '#ff8a65'; ctx.font = 'bold 13px monospace';
ctx.fillText('y = x² + ' + t.toFixed(1), 18, 84);
ctx.fillStyle = 'rgba(255,138,101,0.6)'; ctx.font = '11px sans-serif';
ctx.fillText('縦方向に ' + t.toFixed(1) + ' 移動', 18, 98);
ctx.fillStyle = '#66bb6a'; ctx.font = 'bold 13px monospace';
ctx.fillText('y = |x² - 1|', 18, 116);
// Legend on right
ctx.fillStyle = 'rgba(0,0,0,0.6)';
ctx.beginPath(); ctx.roundRect(W - 175, H - 60, 163, 48, 6); ctx.fill();
ctx.fillStyle = '#4fc3f7'; ctx.font = '12px sans-serif';
ctx.fillText('— y=(x-t)² 平行移動', W - 165, H - 42);
ctx.fillStyle = '#ff8a65';
ctx.fillText('— y=x²+t 平行移動', W - 165, H - 26);
ctx.fillStyle = '#ef5350';
ctx.fillText('— y=-x² x 軸対称', W - 165, H - 10);
requestAnimationFrame(loop);
}
loop(); 各変換の詳細
① 平行移動
「住所をずらす」——グラフの形を変えずに、場所だけ動かします。
→ 方向に 、 方向に
例: → (右3・上2)——「頂点が から に移動する」
② 対称移動
「鏡に映す」——どの鏡( 軸・ 軸・原点)で反射させるかで公式が変わります。
| 変換 | 意味 |
|---|---|
| 軸対称——「 の符号を逆にする」 | |
| 軸対称——「 の符号を逆にして入力する」 | |
| 原点対称——「両方の符号を逆にする」 |
③ 絶対値変換
「マイナスの部分をプラスに折り返す」——グラフの一部が鏡のように反転します。
: の部分を 軸に関して折り返す——「 軸の下にある部分が上に跳ね返る」
: の部分を 軸に関して折り返す——「右半分を左にコピーする」
のグラフ
V字型のグラフで、 が頂点。 と を合わせた形——「右半分は右上がりの直線、左半分は右下がりの直線」です。
練習問題
- を「右2、下3」移動したグラフの式を求めよ。
- のグラフを 軸対称移動したグラフの式を求め、定義域も答えよ。
- のグラフを に変換したとき、変化する部分を説明せよ。
- のグラフの頂点・軸・開口方向を答えよ。
解答
- (定義域:)
- の部分( の部分)が 軸の下から上に折り返される
- 頂点 、軸 、上に凸()
まとめ
グラフ変換は以下の順で理解しましょう——「どんな操作をしたか」を一つずつ確認するのが確実です:
- 平行移動:(右)、(上)——「括弧の中を引いたら右、足したら左」
- 対称移動:(軸)、(軸)、(原点)——「どの軸で折るかで符号が変わる」
- 伸縮:(方向)、(方向圧縮)——「 方向は外の係数、 方向は中の係数」
- 絶対値:(下部を折り返し)、(右半分を折り返し)——「どちらを折るかが違う」
次回は関数とグラフを使って方程式・不等式を視覚的に解く方法を学びます。「式を解く」ではなく「グラフの交点を探す」という視点の転換が鍵です。