微分の計算規則
微分の基本公式
「毎回ゼロから計算しなくていい、便利なパターンがある」——前回は定義から を導きました。しかし毎回定義から計算するのは大変です。以下の公式を覚えておくと、ほとんどの関数を素早く微分できます。
べき乗則(Power Rule)
「 の肩の数を前に降ろして、肩の数を 1 つ減らす」——これがべき乗則のパターンです:
定数の微分
「一定の高さの水平な道の傾きはゼロ」——定数は変化しないので微分するとゼロになります:
定数倍の法則
「2 倍にした関数の傾きは、元の関数の傾きの 2 倍」——スケールを変えても傾きの比率は保たれます:
和・差の法則
「足した関数の傾きは、それぞれの傾きを足したもの」——微分は足し算と順序を入れ替えられます:
具体的な計算例
例 1: ——「各項に対してべき乗則を適用するだけ」:
例 2: ——「分数のべき乗に書き直してからべき乗則を使う」:
例 3:
「展開してから微分するのが基本」——まず展開して多項式の形にしてから各項を微分します。
微分係数の符号と増減
「上り坂か下り坂か」——導関数 の符号が の増減と直結しています。坂の傾きが正なら上り坂、負なら下り坂です:
- ならば はその区間で増加——「傾きが正 = 上り坂」
- ならば はその区間で減少——「傾きが負 = 下り坂」
- ならば極値の候補(増減が逆転する点)——「傾きがゼロ = 山頂または谷底」
デモ: と
(青)と (緑)を重ねて描いています。 なので、 は常に単調増加( で 、一時的に「平ら」になる)。マウスを動かすと接線の傾きがリアルタイムに表示されます。
function loop() {
ctx.clearRect(0, 0, W, H);
var scale=50;
var ox=W/2, oy=H/2;
function toSx(x){return ox+x*scale;}
function toSy(y){return oy-y*scale;}
function drawAxes(){
ctx.strokeStyle='rgba(255,255,255,0.15)';
ctx.lineWidth=1;
ctx.beginPath();ctx.moveTo(0,oy);ctx.lineTo(W,oy);ctx.stroke();
ctx.beginPath();ctx.moveTo(ox,0);ctx.lineTo(ox,H);ctx.stroke();
ctx.fillStyle='rgba(255,255,255,0.25)';
ctx.font='10px monospace';
ctx.textAlign='center';
for(var i=-5;i<=5;i++){
if(i===0)continue;
ctx.fillText(i,toSx(i),oy+14);
}
ctx.textAlign='right';
for(var j=-3;j<=3;j++){
if(j===0)continue;
ctx.fillText(j,ox-6,toSy(j)+4);
}
}
function plotCurve(f,color,lw){
ctx.strokeStyle=color;ctx.lineWidth=lw||2;
ctx.beginPath();
var first=true;
for(var xi=-W/2;xi<=W/2;xi+=1){
var x=xi/scale;
var y=f(x);
if(!isFinite(y)||Math.abs(y)>H/scale+1){first=true;continue;}
if(first){ctx.moveTo(toSx(x),toSy(y));first=false;}
else ctx.lineTo(toSx(x),toSy(y));
}
ctx.stroke();
}
ctx.fillStyle='#0d1117';
ctx.fillRect(0,0,W,H);
drawAxes();
// f(x)=x^3
plotCurve(function(x){return x*x*x;},'#4fc3f7',2.5);
// f'(x)=3x^2
plotCurve(function(x){return 3*x*x;},'#81c784',2.5);
// Mouse: show tangent at x0 on x^3
var x0=(mx-ox)/scale;
x0=Math.max(-2.8,Math.min(2.8,x0));
var y0=x0*x0*x0;
var slope=3*x0*x0;
// Shade region based on sign of f'
// f'(x)=3x^2 >= 0 always, so always increasing
// Color the region under derivative
ctx.fillStyle='rgba(129,199,132,0.08)';
ctx.fillRect(0,0,W,oy);
// Tangent line
var ext=2.5;
ctx.strokeStyle='rgba(255,202,40,0.9)';
ctx.lineWidth=1.5;
ctx.setLineDash([5,4]);
ctx.beginPath();
ctx.moveTo(toSx(x0-ext),toSy(y0+slope*(-ext)));
ctx.lineTo(toSx(x0+ext),toSy(y0+slope*(ext)));
ctx.stroke();
ctx.setLineDash([]);
// Point on f(x)
ctx.beginPath();ctx.arc(toSx(x0),toSy(y0),6,0,Math.PI*2);
ctx.fillStyle='#ffca28';ctx.fill();
// Point on f'(x)
var yPrime=3*x0*x0;
ctx.beginPath();ctx.arc(toSx(x0),toSy(yPrime),5,0,Math.PI*2);
ctx.fillStyle='#a5d6a7';ctx.fill();
// Vertical dashed lines
ctx.setLineDash([3,3]);
ctx.strokeStyle='rgba(255,202,40,0.3)';
ctx.lineWidth=1;
ctx.beginPath();ctx.moveTo(toSx(x0),toSy(y0));ctx.lineTo(toSx(x0),toSy(yPrime));ctx.stroke();
ctx.beginPath();ctx.moveTo(toSx(x0),toSy(yPrime));ctx.lineTo(toSx(x0),oy);ctx.stroke();
ctx.setLineDash([]);
// Info panel
ctx.fillStyle='rgba(0,0,0,0.65)';
ctx.fillRect(8,8,230,72);
ctx.fillStyle='#4fc3f7';
ctx.font='13px monospace';ctx.textAlign='left';
ctx.fillText('x = '+x0.toFixed(3),16,28);
ctx.fillText('f(x) = x³ = '+y0.toFixed(3),16,46);
ctx.fillStyle='#81c784';
ctx.fillText("f'(x) = 3x² = "+yPrime.toFixed(3),16,64);
// Legend
ctx.fillStyle='#4fc3f7';
ctx.font='12px sans-serif';ctx.textAlign='right';
ctx.fillText('── f(x) = x³',W-10,H-28);
ctx.fillStyle='#81c784';
ctx.fillText("── f'(x) = 3x²",W-10,H-10);
requestAnimationFrame(loop);
}
loop(); べき乗則の証明(概略)
「なぜ肩の数を前に降ろすと正しいのか」——二項定理を使って差分商を展開します:
で第 2 項以降が消え、 だけ残ります——「 を含む項はすべてゼロに近づく」ので、残るのは先頭項だけです。
高階導関数
「傾きをさらに微分する」——坂の急さ(傾き)の変化率も測れます。「坂がだんだん急になるか、なだらかになるか」がグラフの曲がり具合を決めます:
- のとき 、
- : グラフが下に凸(上に開いたお椀型)——「坂の傾きが増加している = 上に開く」
- : グラフが上に凸(下に開いたお椀型)——「坂の傾きが減少している = 下に開く」
となる点を変曲点(inflection point)といいます——「凹凸が切り替わる場所」です。
まとめ
- のとき は増加、 のとき減少——「符号が坂の方向を教えてくれる」
- 高階導関数で凹凸を判定できる——「 の符号がグラフの曲がり方を決める」
次回は積・商・合成関数の微分——より複雑な関数を扱うための 3 つの重要ルールです。