I have been wrestling with this for about 45 mins now, I don't think it's that hard but I can't quite get it.

Prove that the line with equation $\displaystyle y=mx+c$ is a tangent to the hyperbola with equation $\displaystyle \frac{x^2}{a^2}-\frac{y^2}{b^2}=1$ if, and only if $\displaystyle a^2m^2=b^2+c^2$

Simple enough, right? But I ended up with two A4 sides of working (which I won't repeat here) and a complete mess. My approach was to prove that if it was a tangent then when I solved the two equations simultaneously the discriminant of the resulting quadratic would be equal to zero (since the tangent only touches once), I was hoping to rearrange this to get the required relationship between a,m,b and c. This didn't work as expected.

I also have no idea how to prove the converse

Any help would be great! Thanks!