Q:

Where is the $-2$ coming from?

If $y=x +\frac 1x$, how is $x^2 + \frac1{x^2} = y^2 - 2$. 
Shouldn't the answer be just $y^2$, where is the $-2$ coming from.

A:

Because $$y^2=\left(x+\frac{1}{x}\right)^2=x^2+\frac{1}{x^2}+2.$$
We used $(a+b)^2=a^2+b^2+2ab.$

A:

$$\left(x+\frac{1}{x}\right)^2 = x^2+2\frac{x}{x}+\frac{1}{x^2} =x^2+2+\frac{1}{x^2}$$

