Equation of the Tangent to a Circle with Slope m
Formula
The equation of the tangent line to the circle $x^{2}+y^{2}=r^{2}$ with slope $m$ is as follows.
$$ y=mx \pm r\sqrt{m^{2}+1} $$
Proof
Let’s denote the equation of the line with slope $m$ as $y=mx+n$. Substituting into the equation of the circle and rearranging for x, we get
$$ \begin{align*} x^2+(mx+n)^2 =&\ r^2 \\ x^2+m^2x^2+2mnx+n^2-r^2 =&\ 0 \\ (1+m^2)x^2+2mnx+n^2-r^2 =&\ 0 \end{align*} $$
Since the circle and the line are tangent to each other, the discriminant is $D=0$.
$$ \begin{align*} D =&\ (2mn)^2-4(1+m^2)(n^2-r^2) \\ =&\ 4m^2n^2-4(n^2-r^2+m^2n^2-m^2r^2) \\ =&\ 4m^2n^2-4n^2+4r^2-4m^2n^2+4m^2r^2 \\ =&\ -4(n^2-r^2-m^2r^2)=0 \end{align*} $$
Therefore,
$$ \begin{align*} && n^2 =&\ r^2m^2+r^2=r^2(m^2+1) \\ \implies && n =&\ \pm r\sqrt{m^2+1} \end{align*} $$
Hence, the equation of the tangent line to circle $x^2+y^2=r^2$ with slope $m$ is
$$ y=mx\pm r\sqrt{m^2+1} $$
■