<s>[INST] Trig and algebra problem: Finding sides of a triangle Let $ABC$ be a triangle such that $\angle ACB = \pi/6$ and let $a,b,c$ denote the lengths of the sides opposite to $A,B,C$, respectively. What are the value(s) of x for which $a = x^2 + x + 1, b = x^2-1$ and $c = 2x+1$?
I used law of cosines, then saw that I should apply the identity $a^2 + b^2 = (1/2)[(a+b)^2 + (a-b)^2]$, but I didn't know how to handle the remaining terms. (In other words, I got stuck early in the problem).
 [/INST] HINT: 
Applying Law of Cosines, $$\cos \frac\pi6=\frac{a^2+b^2-c^2}{2ab}$$
Now, $$b^2+a^2-c^2=(x^2-1)^2+(x^2+x+1)^2-(2x+1)^2$$
$$=(x^2-1)^2+(x^2-x)(x^2+3x+2)\text{ applying } (a^2-b^2)=(a+b)(a-b)\text{ for the last two terms}$$
$$=(x^2-1)^2+x(x-1)(x+1)(x+2)$$
$$=(x^2-1)\{x^2-1+x(x+2)\}=(x^2-1)(2x^2+x-1)$$
As $x^2-1\ne0$ (which would make $b=0$)
$$\frac{(x^2-1)(2x^2+x-1)}{2(x^2-1)(x^2+x+1)}=\frac{(2x^2+x-1)}{2(x^2+x+1)}=\cos \frac\pi6=\frac{\sqrt3}2$$
Can you complete it now?
</s>