# 餘弦定理

$c^2 = a^2 + b^2 - 2ab\cos(\gamma)\,$

$b^2 = c^2 + a^2 - 2ca\cos(\beta)\,$
$a^2 = b^2 + c^2 - 2bc\cos(\alpha)\,$

$c^2 = a^2 + b^2$

## 歷史

$\overline{AB}^2 = \overline{CA}^2 + \overline{CB}^2 + 2(\overline{CA})(\overline{CH})\,$

$\overline{AB}^2 = \overline{CA}^2 + \overline{CB}^2 - 2(\overline{CA})(\overline{BC})\cos(\gamma)\,$

## 證明

### 三角函數

$c=a\cos(\beta)+b\cos(\alpha)\,$

$c^2 = ac\cos(\beta) + bc\cos(\alpha)\,$

$a^2 = ac\cos(\beta) + ab\cos(\gamma)\,$
$b^2 = bc\cos(\alpha) + ab\cos(\gamma)\,$

$a^2 + b^2 = ac\cos(\beta) + ab\cos(\gamma)\, + bc\cos(\alpha) + ab\cos(\gamma)\,$
$a^2 + b^2 = \left[ac\cos(\beta) + bc\cos(\alpha)\right] + \left[ab\cos(\gamma)\, + ab\cos(\gamma)\right]\,$
$a^2 + b^2 = c^2 + 2ab\cos(\gamma)\,$
$c^2 = a^2 + b^2 - 2ab\cos(\gamma)\,$

### 勾股定理

$\triangle ABC$中，$\overline{AB}=c$$\overline{BC}=a$$\overline{AC}=b$。過$B$點作$AC$垂線垂足$D$，如果$D$$AC$內部，則$BD$的長度為$a \sin C$$DC$的長度為$a \cos C$$AD$的長度為$b - a \cos C$。根據勾股定理

$c^2=(a\sin C)^2+(b-a\cos C)^2 \,$
$c^2=a^2\sin^2 C+b^2-2ab\cos C+a^2\cos^2 C \,$
$c^2=a^2(\sin^2 C+\cos^2 C)+b^2-2ab\cos C \,$
$c^2=a^2+b^2-2ab\cos C \,$

### 向量

$\triangle ABC$中，$\overline{AB}=c$$\overline{BC}=a$$\overline{AC}=b$

$\left| \vec{BC} \right|^2 = \vec{BC} \cdot \vec{BC}$
$\left| \vec{BC} \right|^2 = (\vec{AC} - \vec{AB})\cdot (\vec{AC} - \vec{AB})$
$\left| \vec{BC} \right|^2 = \left| \vec{AC} \right|^2 + \left| \vec{AB} \right|^2 - 2\vec{AB}\cdot \vec{AC}$
$\left| \vec{BC} \right|^2 = \left| \vec{AC} \right|^2 + \left| \vec{AB} \right|^2 - 2\left| \vec{AB} \right| \left| \vec{AC} \right|\cos A$
$a^2 = b^2 + c^2 - 2bc\cos A$

## 應用

### 求邊

$a = \sqrt {b^2 + c^2 - 2bc\cos A}$
$b = \sqrt {c^2 + a^2 - 2ac\cos B}$
$c = \sqrt {a^2 + b^2 - 2ab\cos C}$

### 求角

$\cos A = \frac{{b^2 + c^2 - a^2 }}{{2bc}}\,\!$
$\cos B = \frac{{c^2 + a^2 - b^2 }}{{2ca}}\,\!$
$\cos C = \frac{{a^2 + b^2 - c^2 }}{{2ab}}\,\!$

$\angle A = \arccos \frac{{b^2 + c^2 - a^2 }}{{2bc}}\,\!$
$\angle B = \arccos \frac{{c^2 + a^2 - b^2 }}{{2ca}}\,\!$
$\angle C = \arccos \frac{{a^2 + b^2 - c^2 }}{{2ab}}\,\!$

## 參考資料

1. ^ In obtuse-angled triangles the square on the side subtending the obtuse angle is greater than the squares on the sides containing the obtuse angle by twice the rectangle contained by one of the sides about the obtuse angle, namely that on which the perpendicular falls, and the straight line cut off outside by the perpendicular towards the obtuse angle. --- Euclid's Elements, translation by Thomas L. Heath.