今天上機率時,老師有提到相乘要用什麼方式可以讓他們變成相加,老師提到了取 log 之後,我才突然想起 log 這東西真的很好用。
在微積分討論微分時,會提到一個公式稱作Product Rule(乘法法則):
f(x)g(x)=f′(x)g(x)+f(x)g′(x)
但是,假設當 k=1,2,…,n 時,fk 是一個在區間內可微函數。如果要問你找 k=1∏nfk(x) 的微分,用公式去暴力一個一個解開,一定很耗時間吧。
這時,我們就需要用到取 log 了。
Theorem (General Product Rule)
Let fi be a differentiable functions on an open interval for i=1,2,…,n. Then the derivative of k=1∏nfk(x) is
(k=1∏nfk(x))′=(k=1∏nfk(x))⋅(k=1∑nfk(x)fk′(x)).
接下來,我們會證明這個公式,也算是讓你推導說如何求出兩個以上函數相乘的微分。
Proof. It is easy to solve (fg)′=f′g+fg′ by product rule. However, it is difficult to solve when more than two function. We know that
ln(k=1∏nfk(x))=k=1∑nlnfk(x).
Differentiate both side, we obtain
[ln(k=1∏nfk(x))]′=(k=1∑nlnfk(x))′⟺k=1∏nfk(x)1(k=1∏nfk(x))′=k=1∑nfk(x)fk′(x)⟺(k=1∏nfk(x))′=(k=1∏nfk(x))⋅(k=1∑nfk(x)fk′(x)).
Hence
(k=1∏nfk(x))′=(k=1∏nfk(x))⋅(k=1∑nfk(x)fk′(x)).
當想到使用取對數時,這個廣義的 Product Rule 就會變得很好解,也算是突然想到可以試著找有沒有廣義的 Product Rule 公式然後去證明。