多項式の割り算と剰余定理
多項式の割り算
「17 ÷ 5 = 3 余り2」——整数の割り算では「商」と「余り」が出てきます。多項式でも全く同じことができます。「式の17に相当する式を、式の5に相当する式で割る」というイメージです。
整数の割り算 (商3、余り2)と同様に、多項式にも割り算があります。
- :被除式(割られる式)
- :除式(割る式)
- :商
- :余り(次数 < の次数)
長除法
を で割ります。「数の筆算と同じ手順で、式の係数を扱う」だけです。
x² + 4x + 7
____________
x - 2 | x³ + 2x² - x + 3
x³ - 2x²
-----------
4x² - x
4x² - 8x
----------
7x + 3
7x - 14
---------
17 ← 余り
よって商 、余り
検算: ✓
剰余定理の確認
これは余り と一致しています。剰余定理の通りです:
「 を代入した値が余りになる」——割り算の計算を最後までしなくても、代入するだけで余りがわかります。
組立除法の復習
で割る場合は組立除法が高速です——「式全体を書かずに、係数だけを操作する省力版の割り算」です。
を で割る():
2 | 1 2 -1 3
| 2 8 14
----------------
1 4 7 17
- 商の係数: →
- 余り:
手順:
- 最初の係数をそのまま下へ
- 下の数 × → 右にずらして上の数に足す
- 繰り返す
- 最後の数が余り
因数定理との連携
第10回で学んだ因数定理をここでもう一度確認します。
これは剰余定理の特別な場合です。余りがゼロ = 割り切れる = 因数——「余りなくピッタリ割れる」ということが「因数」の定義です。
例: を完全因数分解
有理根候補:
→ は因数——代入してゼロになった!
1 | 1 0 -7 6
| 1 1 -6
-----------------
1 1 -6 0
商:
完全因数分解:
グラフと根の可視化
function loop() {
ctx.clearRect(0, 0, W, H);
var cx = W/2, cy = H/2;
var scaleX = 50, scaleY = 10;
var a = -4 + (mx/W)*8; // -4 to 4
// Grid
ctx.strokeStyle = '#1a2036'; ctx.lineWidth = 1;
for (var gx=-5; gx<=5; gx++) {
ctx.beginPath(); ctx.moveTo(cx+gx*scaleX,0); ctx.lineTo(cx+gx*scaleX,H); ctx.stroke();
}
// Axes
ctx.strokeStyle = '#334155'; ctx.lineWidth = 1.5;
ctx.beginPath(); ctx.moveTo(0,cy); ctx.lineTo(W,cy); ctx.stroke();
ctx.beginPath(); ctx.moveTo(cx,0); ctx.lineTo(cx,H); ctx.stroke();
ctx.fillStyle = '#475569'; ctx.font = '11px monospace'; ctx.textAlign = 'center';
for (var n=-5; n<=5; n++) {
if (n===0) continue;
ctx.fillText(n, cx+n*scaleX, cy+14);
}
// f(x) = x³ - 7x + 6
ctx.strokeStyle = '#3b82f6'; ctx.lineWidth = 2.5;
ctx.beginPath();
var started = false;
for (var px=0; px<=W; px+=2) {
var xv = (px-cx)/scaleX;
var yv = xv*xv*xv - 7*xv + 6;
var py = cy - yv * scaleY;
if (py < -60 || py > H+60) { started=false; continue; }
if (!started) { ctx.moveTo(px,py); started=true; } else ctx.lineTo(px,py);
}
ctx.stroke();
// Roots at x=-3, 1, 2
var roots = [-3, 1, 2];
var rootColors = ['#ef4444','#fbbf24','#22c55e'];
for (var ri=0; ri<3; ri++) {
ctx.fillStyle = rootColors[ri];
ctx.beginPath();
ctx.arc(cx+roots[ri]*scaleX, cy, 7, 0, Math.PI*2);
ctx.fill();
ctx.fillStyle = rootColors[ri]; ctx.font='bold 13px monospace'; ctx.textAlign='center';
ctx.fillText('x='+roots[ri], cx+roots[ri]*scaleX, cy-16);
}
// Slider point for f(a)
var fa = a*a*a - 7*a + 6;
var sliderPx = cx + a*scaleX;
var sliderPy = cy - fa*scaleY;
sliderPy = Math.max(10, Math.min(H-10, sliderPy));
// Dashed vertical line
ctx.strokeStyle = '#fbbf24'; ctx.lineWidth = 1; ctx.setLineDash([4,4]);
ctx.beginPath(); ctx.moveTo(sliderPx, cy); ctx.lineTo(sliderPx, sliderPy); ctx.stroke();
ctx.setLineDash([]);
// Point on curve
var isRoot = Math.abs(fa) < 0.3;
ctx.fillStyle = isRoot ? '#22c55e' : '#f59e0b';
ctx.beginPath();
ctx.arc(sliderPx, sliderPy, 8, 0, Math.PI*2);
ctx.fill();
// Info panel
ctx.fillStyle = '#0f172a'; ctx.fillRect(8,8,280,90);
ctx.strokeStyle = '#334155'; ctx.lineWidth=1; ctx.strokeRect(8,8,280,90);
ctx.font='13px monospace'; ctx.textAlign='left';
ctx.fillStyle = '#e2e8f0';
ctx.fillText('f(x) = x³ - 7x + 6', 18, 28);
ctx.fillText('a = ' + a.toFixed(2), 18, 48);
ctx.fillStyle = isRoot ? '#22c55e' : '#f59e0b';
ctx.fillText('f(a) = ' + fa.toFixed(3) + (isRoot ? ' ≈ 0 → 根!' : ''), 18, 68);
ctx.fillStyle = '#94a3b8';
ctx.fillText('因数分解:(x+3)(x-1)(x-2)', 18, 88);
requestAnimationFrame(loop);
}
loop(); のとき が因数である理由
「なぜ代入してゼロになると因数なのか?」——剰余定理から直接証明できます:
( は定数)
を代入:
なら 、つまり (割り切れる)
「代入してゼロ → 余りがゼロ → 割り切れる → 因数」という論理のつながりです。
一般の除式による割り算
を2次式 で割る場合、余りは1次以下の式 になります。
例: を で割る
長除法の手順:
x^4 ÷ x^2 = x^2 → x^2(x^2-1) = x^4-x^2 → 余り: x^2+1
x^2 ÷ x^2 = 1 → 1(x^2-1) = x^2-1 → 余り: 2
結果:
剰余定理の拡張: でも でも確認できます。
恒等式と方程式の違い
「両者の違いを意識していなかった」という人は意外と多いです。
恒等式:すべての の値で成立する等式——「どんな数を代入しても常に正しい」
方程式:特定の の値でのみ成立する等式——「ある特定の数を代入したときだけ正しい」
恒等式の例:
(x-1)(x+1) = x² - 1 ← すべての x で成立
x² + 5x + 6 = (x+2)(x+3) ← すべての x で成立
係数比較法:両辺の同じ次数の係数が等しいことを利用して未知の係数を求める。
例: を求める
: →
: →
係数比較(): →
function polyDiv(coeffs, a) {
// coeffs: [c_n, c_{n-1}, ..., c_0] (high to low)
var result = [coeffs[0]];
for (var i = 1; i < coeffs.length - 1; i++) {
result.push(result[result.length-1]*a + coeffs[i]);
}
var remainder = result[result.length-1]*a + coeffs[coeffs.length-1];
return { quotient: result, remainder: remainder };
}
function loop() {
ctx.clearRect(0, 0, W, H);
var a = -3 + (mx/W)*6;
// f(x) = x^4 - x^3 - 7x^2 + x + 6
var coeffs = [1, -1, -7, 1, 6];
var res = polyDiv(coeffs, a);
var fa = coeffs[0];
for (var i=1; i<coeffs.length; i++) { fa = fa*a + coeffs[i]; }
ctx.fillStyle = '#94a3b8'; ctx.font='14px monospace'; ctx.textAlign='center';
ctx.fillText('f(x) = x⁴ - x³ - 7x² + x + 6 を (x - a) で割る', W/2, 24);
// Synth div display
var ox = 60, oy = 55, colW = 70;
ctx.fillStyle = '#fbbf24'; ctx.font='bold 14px monospace'; ctx.textAlign='right';
ctx.fillText(a.toFixed(2) + ' |', ox-4, oy+20);
var labels = ['x⁴', 'x³', 'x²', 'x¹', 'x⁰'];
for (var i=0; i<coeffs.length; i++) {
ctx.fillStyle = '#93c5fd'; ctx.font='12px monospace'; ctx.textAlign='center';
ctx.fillText(labels[i], ox+i*colW+colW/2, oy);
ctx.fillStyle = '#e2e8f0'; ctx.font='13px monospace';
ctx.fillText(coeffs[i], ox+i*colW+colW/2, oy+20);
}
ctx.strokeStyle = '#334155'; ctx.lineWidth=1;
ctx.beginPath(); ctx.moveTo(ox-10, oy+30); ctx.lineTo(ox+coeffs.length*colW+10, oy+30); ctx.stroke();
// Synthetic division intermediate row
for (var i=0; i<res.quotient.length; i++) {
var mul = i===0 ? 0 : res.quotient[i-1]*a;
ctx.fillStyle = '#86efac'; ctx.font='12px monospace'; ctx.textAlign='center';
if (i>0) ctx.fillText(mul.toFixed(1), ox+i*colW+colW/2, oy+46);
}
ctx.strokeStyle = '#1e3a5f'; ctx.lineWidth=1;
ctx.beginPath(); ctx.moveTo(ox-10, oy+55); ctx.lineTo(ox+coeffs.length*colW+10, oy+55); ctx.stroke();
// Result row
for (var i=0; i<res.quotient.length; i++) {
ctx.fillStyle = '#c4b5fd'; ctx.font='bold 13px monospace'; ctx.textAlign='center';
ctx.fillText(res.quotient[i].toFixed(1), ox+i*colW+colW/2, oy+72);
}
var isRoot = Math.abs(res.remainder) < 0.01;
ctx.fillStyle = isRoot ? '#22c55e' : '#f59e0b';
ctx.font='bold 14px monospace'; ctx.textAlign='center';
ctx.fillText(res.remainder.toFixed(2), ox+res.quotient.length*colW+colW/2, oy+72);
ctx.fillStyle = '#c4b5fd'; ctx.font='13px monospace'; ctx.textAlign='left';
ctx.fillText('商: ' + res.quotient.map(function(v,i){return v.toFixed(1)+'x^'+(3-i);}).join(' + '), ox, oy+100);
ctx.fillStyle = isRoot ? '#22c55e' : '#f59e0b';
ctx.fillText('余り: ' + res.remainder.toFixed(3) + (isRoot ? ' → 因数! (x - '+a.toFixed(2)+') は f(x) の因数' : ''), ox, oy+122);
ctx.fillStyle = '#fbbf24'; ctx.font='bold 13px monospace'; ctx.textAlign='left';
ctx.fillText('剰余定理: f(' + a.toFixed(2) + ') = ' + fa.toFixed(3), ox, oy+148);
var match = Math.abs(fa - res.remainder) < 0.01;
ctx.fillStyle = match ? '#22c55e' : '#ef4444';
ctx.fillText(match ? '✓ 一致確認' : '計算エラー', ox+250, oy+148);
ctx.fillStyle = '#64748b'; ctx.font='12px monospace'; ctx.textAlign='center';
ctx.fillText('マウスで a を変える(現在 a = ' + a.toFixed(2) + ')', W/2, H-14);
requestAnimationFrame(loop);
}
loop(); このシリーズで学んだこと:全体マップ
式の展開 (ep.1)
↓ 逆操作
因数分解の基本 (ep.2) → 応用 (ep.3)
↓ 応用先
有理式 (ep.4) ←→ 方程式・不等式 (ep.8-12)
↑
根号・無理数 (ep.5) ← 有理化
↑
複素数 (ep.6-7) ← √-1 の世界
高次方程式 (ep.10) ← 因数定理 (ep.10, 15)
絶対値 (ep.13)
二項定理 (ep.14)
多項式除法 (ep.15) ← 剰余定理 → 因数定理
まとめ
- 多項式 を で割った余りは (剰余定理)——「割り算の余り = 代入した値」
- なら は因数(因数定理)——「代入してゼロ = 割り切れる」
- 長除法:数の割り算と同じ手順で係数を操作——「筆算と同じ感覚」
- 組立除法: で割る場合の高速アルゴリズム——「係数だけで計算する省力版」
- 恒等式:すべての で成立。係数比較で未知数を求める——「どんな値を代入しても成り立つ」
シリーズ「代数と式の操作」を終えて
15回にわたって代数の核心を巡ってきました。
| 回 | テーマ | 核心の概念 |
|---|---|---|
| 1-3 | 展開と因数分解 | 積⇔和の変換 |
| 4-5 | 有理式・無理数 | 分母の整理 |
| 6-7 | 複素数 | i = √-1 の世界 |
| 8-10 | 方程式 | 等式・高次・因数定理 |
| 11-13 | 不等式・絶対値 | 解の範囲・場合分け |
| 14-15 | 二項定理・除法 | 係数の構造 |
代数は「式を変形して本質を取り出す」技術です。すべての操作は「見た目を変えるが値は変えない」という一点に集約されます——「変形しても等しい」という感覚が身についたとき、数学は一段と面白くなります。
次のステップとして、「数学関数とグラフ」シリーズや「微積分入門」シリーズへの挑戦をお勧めします。ここで学んだ代数の力が縦横無尽に活躍するでしょう。