#12 ふれてみよう高校数学 関数

合成関数と逆関数

合成関数

「コーヒーを作るには、まずお湯を沸かして(関数 gg)、それからコーヒー粉を入れて抽出する(関数 ff)」——2つの操作を順番に組み合わせる、これが合成関数のイメージです。

2つの関数 ffgg があるとき、gg の値を ff に代入した新しい関数

(fg)(x)=f(g(x))(f \circ g)(x) = f(g(x))

ffgg合成関数といいます。

注意

  • 一般に fggff \circ g \neq g \circ f(順序が重要)——「お湯を沸かしてからコーヒーを入れる」と「コーヒーを入れてからお湯を沸かす」は違う結果になります
  • gg の値域が ff の定義域に含まれている必要がある

f(x)=x2f(x) = x^2g(x)=x+1g(x) = x + 1 のとき:

(fg)(x)=f(g(x))=f(x+1)=(x+1)2(f \circ g)(x) = f(g(x)) = f(x+1) = (x+1)^2 (gf)(x)=g(f(x))=g(x2)=x2+1(g \circ f)(x) = g(f(x)) = g(x^2) = x^2 + 1

(x+1)2x2+1(x+1)^2 \neq x^2 + 1 なので、fggff \circ g \neq g \circ f——順序を逆にすると全然違う関数になります。


逆関数

「ある操作を元に戻す操作」——逆関数とはそういうものです。「2倍にする」関数の逆は「半分にする」関数。「3を足す」関数の逆は「3を引く」関数です。

関数 y=f(x)y = f(x) において、xxyy を入れ替えた関数が存在するとき、それを逆関数 f1(x)f^{-1}(x) といいます。

逆関数の求め方

  1. y=f(x)y = f(x)xx について解く
  2. xxyy を入れ替える(x=f1(y)x = f^{-1}(y)y=f1(x)y = f^{-1}(x)

yy をいじって xx を求めてから、ラベルを入れ替える」——この2ステップだけです。

f(x)=2x+3f(x) = 2x + 3 の逆関数を求めよ。

y=2x+3y = 2x + 3x=y32x = \dfrac{y-3}{2} → 入れ替えて:

f1(x)=x32f^{-1}(x) = \frac{x - 3}{2}

確認:f(f1(x))=2x32+3=x3+3=xf(f^{-1}(x)) = 2 \cdot \dfrac{x-3}{2} + 3 = x - 3 + 3 = x(元に戻る)


逆関数の存在条件

関数 ff が逆関数を持つためには、ff単射(1対1対応)である必要があります。

つまり、x1x2    f(x1)f(x2)x_1 \neq x_2 \implies f(x_1) \neq f(x_2) が成り立つ必要があります——「違う入力からは、必ず違う出力が出る」ということです。

「同じ結果が出る入力が複数あると、逆向きに戻せない」——たとえば y=x2y = x^2y=4y = 4 を入れると x=2x = 2x=2x = -2 の2つが出てきて、「どちらに戻せばいいか」がわかりません。

y=x2y = x^2R\mathbb{R} 全体では単射でないため逆関数を持ちませんが、x0x \geq 0 に制限すると単射になり、逆関数 y=xy = \sqrt{x} が存在します。


インタラクティブデモ:関数と逆関数の対称性

y=x2y = x^2x0x \geq 0)(青)と逆関数 y=xy = \sqrt{x}(オレンジ)は、直線 y=xy = x(緑の点線)に関して対称です。マウスを左右に動かすと、対応する点ペアが強調されます——青い点と橙色の点がちょうど y=xy=x の線に対して鏡対称になっているのを確認してください。

青: y=x²(x≥0) オレンジ: y=√x 緑点線: y=x(対称軸)
function loop() {
ctx.clearRect(0, 0, W, H);

var ox = W / 2 - 100, oy = H / 2 + 100;
var scale = 45;
var xVal = (mx / W) * 5;
xVal = Math.max(0, Math.min(5, xVal));

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 gi = 0; gi <= 6; gi++) {
  var gs = toScreen(gi, 0);
  ctx.beginPath(); ctx.moveTo(gs.sx, 0); ctx.lineTo(gs.sx, H); ctx.stroke();
  var gs2 = toScreen(0, gi);
  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.4)';
ctx.font = '12px sans-serif';
for (var lx = 1; lx <= 5; lx++) {
  var ls = toScreen(lx, 0);
  ctx.fillText(lx, ls.sx - 4, oy + 16);
}
for (var ly = 1; ly <= 5; ly++) {
  var ls2 = toScreen(0, ly);
  ctx.fillText(ly, ox + 6, ls2.sy + 4);
}

// y=x line (green dashed)
ctx.strokeStyle = 'rgba(102,187,106,0.45)';
ctx.lineWidth = 1.5;
ctx.setLineDash([6,4]);
ctx.beginPath();
var sA = toScreen(0, 0), sB = toScreen(5.5, 5.5);
ctx.moveTo(sA.sx, sA.sy); ctx.lineTo(sB.sx, sB.sy); ctx.stroke();
ctx.setLineDash([]);
ctx.fillStyle = 'rgba(102,187,106,0.7)';
ctx.font = '13px sans-serif';
ctx.fillText('y = x', toScreen(4.6, 4.9).sx, toScreen(4.6, 4.9).sy);

// y=x^2 (x>=0) - blue
ctx.strokeStyle = '#4fc3f7';
ctx.lineWidth = 2.5;
ctx.beginPath();
var st1 = false;
for (var xi = 0; xi <= 5.5; xi += 0.03) {
  var yi = xi * xi;
  if (yi > 6) { st1 = false; continue; }
  var s = toScreen(xi, yi);
  if (!st1) { ctx.moveTo(s.sx, s.sy); st1 = true; } else ctx.lineTo(s.sx, s.sy);
}
ctx.stroke();
ctx.fillStyle = '#4fc3f7';
ctx.font = 'bold 13px sans-serif';
ctx.fillText('y = x² (x≥0)', toScreen(1.5, 5.5).sx, toScreen(1.5, 5.5).sy);

// y=sqrt(x) - orange
ctx.strokeStyle = '#ffb74d';
ctx.lineWidth = 2.5;
ctx.beginPath();
var st2 = false;
for (var xi2 = 0; xi2 <= 5.5; xi2 += 0.03) {
  var yi2 = Math.sqrt(xi2);
  var s2 = toScreen(xi2, yi2);
  if (!st2) { ctx.moveTo(s2.sx, s2.sy); st2 = true; } else ctx.lineTo(s2.sx, s2.sy);
}
ctx.stroke();
ctx.fillStyle = '#ffb74d';
ctx.fillText('y = √x', toScreen(5.0, 2.4).sx, toScreen(5.0, 2.4).sy);

// Symmetric pair
var yOnF = xVal * xVal;
var yOnInv = Math.sqrt(xVal);

if (yOnF <= 6) {
  var pF = toScreen(xVal, yOnF);
  var pMirrorF = toScreen(yOnF, xVal);
  ctx.strokeStyle = 'rgba(255,235,59,0.5)';
  ctx.lineWidth = 1.5;
  ctx.setLineDash([3,3]);
  ctx.beginPath(); ctx.moveTo(pF.sx, pF.sy); ctx.lineTo(pMirrorF.sx, pMirrorF.sy); ctx.stroke();
  ctx.setLineDash([]);
  ctx.fillStyle = '#4fc3f7';
  ctx.beginPath(); ctx.arc(pF.sx, pF.sy, 6, 0, Math.PI*2); ctx.fill();
  ctx.fillStyle = '#ffb74d';
  ctx.beginPath(); ctx.arc(pMirrorF.sx, pMirrorF.sy, 6, 0, Math.PI*2); ctx.fill();
}

var pInv = toScreen(xVal, yOnInv);
var pMirrorInv = toScreen(yOnInv, xVal);
ctx.strokeStyle = 'rgba(255,235,59,0.3)';
ctx.lineWidth = 1.5;
ctx.setLineDash([3,3]);
ctx.beginPath(); ctx.moveTo(pInv.sx, pInv.sy); ctx.lineTo(pMirrorInv.sx, pMirrorInv.sy); ctx.stroke();
ctx.setLineDash([]);
ctx.fillStyle = '#ffb74d';
ctx.beginPath(); ctx.arc(pInv.sx, pInv.sy, 6, 0, Math.PI*2); ctx.fill();

// Info panel
ctx.fillStyle = 'rgba(0,0,0,0.65)';
ctx.beginPath(); ctx.roundRect(10, 10, 230, 70, 8); ctx.fill();
ctx.fillStyle = '#ffeb3b';
ctx.font = 'bold 13px monospace';
ctx.fillText('x = ' + xVal.toFixed(2), 18, 32);
ctx.fillStyle = '#4fc3f7';
ctx.font = '13px monospace';
ctx.fillText('f(x) = x² = ' + (xVal*xVal).toFixed(2), 18, 52);
ctx.fillStyle = '#ffb74d';
ctx.fillText('f⁻¹(x) = √x = ' + yOnInv.toFixed(3), 18, 70);

requestAnimationFrame(loop);
}
loop();

合成関数と逆関数の関係

「操作して、戻す」——これを繰り返すと元に戻ります。逆関数の定義から、次が成り立ちます:

(ff1)(x)=f(f1(x))=x(f \circ f^{-1})(x) = f(f^{-1}(x)) = x (f1f)(x)=f1(f(x))=x(f^{-1} \circ f)(x) = f^{-1}(f(x)) = x

これは恒等関数id(x)=x\text{id}(x) = x)になります——「何もしない関数」です。「前進して後退すれば元の場所に戻る」のと同じ論理です。


グラフ上の対称性

関数 y=f(x)y = f(x) と逆関数 y=f1(x)y = f^{-1}(x) のグラフは、直線 y=xy = x に関して対称です。

理由y=f(x)y = f(x) の点 (a,b)(a, b)y=f1(x)y = f^{-1}(x) では (b,a)(b, a) に対応します。(a,b)(a,b)(b,a)(b,a)y=xy = x に関して対称——「xx 座標と yy 座標が入れ替わる」という逆関数の定義が、そのままグラフの対称性として現れます。


練習問題

  1. f(x)=3x5f(x) = 3x - 5 の逆関数 f1(x)f^{-1}(x) を求めよ。
  2. f(x)=x+1f(x) = \sqrt{x+1}x1x \geq -1)の逆関数を求めよ。
  3. f(x)=x2+1f(x) = x^2 + 1x0x \geq 0)と g(x)=2x1g(x) = 2x - 1 の合成関数 f(g(x))f(g(x)) を求めよ。

解答

  1. y=3x5y = 3x-5x=y+53x = \dfrac{y+5}{3}f1(x)=x+53f^{-1}(x) = \dfrac{x+5}{3}
  2. y=x+1y = \sqrt{x+1}y2=x+1y^2 = x+1x=y21x = y^2 - 1f1(x)=x21f^{-1}(x) = x^2 - 1x0x \geq 0
  3. f(g(x))=f(2x1)=(2x1)2+1=4x24x+2f(g(x)) = f(2x-1) = (2x-1)^2 + 1 = 4x^2 - 4x + 2

まとめ

  • 合成関数:(fg)(x)=f(g(x))(f \circ g)(x) = f(g(x))、順序に注意——「逆順は別の関数」
  • 逆関数:f1(x)f^{-1}(x)xxyy を入れ替えて解く——「操作を逆向きにする」
  • 逆関数の存在条件:ff が単射(1対1)であること——「同じ結果が出る入力が二つあったら逆には戻れない」
  • y=f(x)y = f(x)y=f1(x)y = f^{-1}(x)y=xy = x に関して対称

次回は分数関数と無理関数を学びます。「1x\dfrac{1}{x}」の双曲線と「x\sqrt{x}」の半放物線——どちらも日常の現象を記述する重要なグラフです。