# Law of Cosines Distance Formula Proof

So I'm trying to understand a law of cosines proof that involves the distance formula and I'm having trouble. I've included the proof below from wikipedia that I'm trying to follow. What I'm have trouble understanding is the way they define the triangle point A.

I've always been taught that cosine represents $\frac{adj}{hyp}$ so I'm not sure what cosine represents outside the context of a right triangle. After I understand this I can follow the proof I'm just trying to understand how $b \cos\gamma,\ b \sin\gamma$ represent the x and y coordinates with a generic angle in $\gamma$. Any other resources or advice would be appreciated.

$A = (b \cos\gamma,\ b \sin\gamma),\ B = (a,\ 0),\ \text{and}\ C = (0,\ 0)\,.$

By the distance formula, we have $c = \sqrt{(a - b \cos\gamma)^2 + (0 - b \sin\gamma)^2}\,.$

Now, we just work with that equation: :\begin{align} c^2 & {} = (a - b \cos\gamma)^2 + (- b \sin\gamma)^2 \\ c^2 & {} = a^2 - 2 a b \cos\gamma + b^2 \cos^2 \gamma + b^2 \sin^2 \gamma \\ c^2 & {} = a^2 + b^2 (\sin^2 \gamma + \cos^2 \gamma) - 2 a b \cos\gamma \\ c^2 & {} = a^2 + b^2 - 2 a b \cos\gamma\,. \end{align}

-
Here is a really nice proof of the Law of Cosines. –  robjohn Jun 1 '12 at 4:16
–  Joe Jun 1 '12 at 4:16
I actually think I've figured it out, writing out your question really helps you learn. I think I was just setting up my triangles wrong, I noticed a right triangle can be formed that makes sense. –  Math_Illiterate Jun 1 '12 at 4:22

$c$ is the length of the line $AB$, i.e. from $(b \cos\gamma,\ b \sin\gamma)$ to $(a,\ 0)$, which has horizontal component $a - b \cos\gamma$ and vertical component $0 - b \sin\gamma$.
So using Pythagoras, $c = \sqrt{(a - b \cos\gamma)^2 + (0 - b \sin\gamma)^2}$.
Then expand, and simplify using Pythagoras again in $\sin^2 \gamma + \cos^2 \gamma =1$.