Length of Tangent to Circle

Let the equation of the circle be

x2 + y2 + 2gx + 2fy + c = 0

Let PT be the tangent to the circle from P(x1, y1) outside it.

The co-ordinate of the centre C is (− g, − f) and radius r = CT = √(g2 + f2 − c)

From the right angled triangle PCT,

PT2 = PC2 − CT2

PT = √(x12 + y12 + 2gx1 + 2fy1 + c)

If the point P is on the circle, then PT2 = 0 (PT is zero).

If the point P is outside the circle then PT2 > 0 (PT is real) .

If the point P is inside the circle then PT2 < 0 (PT is imaginary).

The constant c will be positive if the origin is outside the circle, zero if it is on the circle and negative if it is inside the circle.