I was going through the vector representation for linear regression. The error has been defined as
$$ Error = {(y_i - x_i^tw)}^2 $$
where $y_i$ is a scalar, $x$ is a $n \times 1$ vector and $w$ is also a $n \times 1$ vector.
On the next line, it has been simplified to
$$ Error = {y_i}^2 -2w^tx_iy_i + w^tx_ix_i^tw $$
Can someone explain how did we reach the second notion through a series of steps?