How to know if a point is inside a circle?

The distance between $\langle x_c,y_c\rangle$ and $\langle x_p,y_p\rangle$ is given by the Pythagorean theorem as $$d=\sqrt{(x_p-x_c)^2+(y_p-y_c)^2}\;.$$ The point $\langle x_p,y_p\rangle$ is inside the circle if $d<r$, on the circle if $d=r$, and outside the circle if $d>r$. You can save yourself a little work by comparing $d^2$ with $r^2$ instead: the point is inside the circle if $d^2<r^2$, on the circle if $d^2=r^2$, and outside the circle if $d^2>r^2$. Thus, you want to compare the number $(x_p-x_c)^2+(y_p-y_c)^2$ with $r^2$.


The point is inside the circle if the distance from it to the center is less than $r$. Symbolically, this is $$\sqrt{|x_p-x_c|^2+|y_p-y_c|^2}< r.$$


Alex and Brian have answered your question already. In case you're trying to implement this algorithm in some programming language, here's my Haskell implementation:

distance :: Floating a => (a, a) -> (a, a) -> a
distance (x1,y1) (x2,y2) = sqrt((x1-x2)**2 + (y1-y2)**2)


isInsideCircle :: (Ord a, Floating a) => a -> (a, a) -> (a, a) -> Bool
isInsideCircle r (xc,yc) (x,y) | (distance (xc,yc) (x,y) < r) = True
                               | (distance (xc,yc) (x,y) >= r) = False

Suppose you have a circle whose radius is $r = 1$ and whose center is the origin $(0,0)$. You would like to know if $(\frac{1}{2},0)$, $(1,0)$, and $(1,1)$ are inside the circle. The following interactive GHCi session answers the question:

*Main> isInsideCircle 1 (0,0) (0.5,0)
True
*Main> isInsideCircle 1 (0,0) (1,0)
False
*Main> isInsideCircle 1 (0,0) (1,1)
False