So in $\triangle ABC$ with angle $\theta$ we can calculate $$c^2 = a^2 + b^2 - 2ab\cos \theta $$ $$\cos\theta = \frac{a^2 + b^2 - c^2}{2ab} $$ $$\Longrightarrow$$ $$c^2 = a^2 + b^2 - 2ab\frac{a^2 + b^2 - c^2}{2ab}$$ $$2ab\frac{a^2 + b^2 - c^2}{2ab} = a^2 + b^2 - c^2$$ $$\Longrightarrow$$ $$c^2 = a^2 + b^2 - a^2 + b^2 - c^2$$ $$c^2+c^2 = a^2 + b^2 - a^2 + b^2$$ $$2c^2 = a^2 + b^2 - a^2 + b^2$$ $$c = \sqrt{\frac{0}{2}}$$ How did this happen? I'm sure I did something wrong.
EDIT:
I just forgot the brackets
$$c^2 = a^2 + b^2 - (a^2 + b^2 - c^2)$$

BRACKETS!!!
$$c^2 = a^2 + b^2 - 2ab\frac{a^2 + b^2 - c^2}{2ab}$$ $$c^2 = a^2 + b^2 - (a^2 + b^2 - c^2)$$ $$c^2 = a^2 + b^2 - a^2 - b^2 + c^2$$ $$c^2 = c^2$$
This is an excellent question to learn to use brackets :-)