For circle S = 0 and point P(x₁, y₁): S₁ > 0 ⟹ P outside; S₁ = 0 ⟹ P on the circle; S₁ < 0 ⟹ P inside.
Let the circle be S≡x2+y2+2gx+2fy+c=0, with centre C(−g,−f) and radius r=g2+f2−c.
For point P(x1,y1), define:
S1=x12+y12+2gx1+2fy1+c
The distance from C to P is d=(x1+g)2+(y1+f)2.
Expanding d2:
d2=x12+2gx1+g2+y12+2fy1+f2=S1+(g2+f2−c)=S1+r2
Therefore d2−r2=S1.
- S1>0⇒d>r⇒P is outside the circle
- S1=0⇒d=r⇒P is on the circle
- S1<0⇒d<r⇒P is inside the circle
This is the standard test. It avoids computing d explicitly — only the sign of S1 matters.