Let #y=mx+c# be a tangent to the circle #x^2+y^2=r^2#.
Then it should touch the circle at one point only. Hence the quadratic equation of #x# obtained from those two equations will have two roots same. This means the discriminant of the quadratic equation of #x# will be zero.
So
#x^2+(mx+c)^2=r^2#
#=>x^2+m^2x^2+2mcx+c^2=r^2#
#=>(1+m^2)x^2+2mcx+c^2-r^2=0#
Taking #color(red)("discriminant" =0)# we get
#4m^2c^2-4(c^2-r^2)(1+m^2)=0#
#=>m^2c^2-(c^2-r^2)(1+m^2)=0#
#=>m^2c^2-c^2(1+m^2)+r^2(1+m^2)=0#
#=>-c^2+r^2(1+m^2)=0#
#=>c^2=r^2(1+m^2)#
#=>c=rsqrt(1+m^2)#
Hence equation of any tangent to the given circle will be
#y=mx+rsqrt(1+m^2)......[1]#
Now if it is drawn from the givenpoint #(a,b)# then
#b=ma+rsqrt(1+m^2)#
#=>(b-ma)^2=r^2(1+m^2)#
#=>b^2-2mab+m^2a^2=r^2+r^2m^2#
#=>m^2a^2-r^2m^2-2mab+b^2-r^2=0#
#=>m^2(a^2-r^2)-2mab+(b^2-r^2)=0#
#=>m=(2abpmsqrt(4a^2b^2-4(a^2-r^2)(b^2-r^2)))/(2(a^2-r^2))#
#=>m=(abpmsqrt(b^2r^2+a^2r^2-r^4))/(a^2-r^2)#
Substituting these two values of #m# in equation [1] we can get equations of two tangents drawn from an external points #(a,b)# to the given circle #x^2+y^2=r^2#.