Having a circle with the centre (xc,yc) with the radius r how to know whether a point (xp,yp) is inside the circle?

**Answer**

The distance between ⟨xc,yc⟩ and ⟨xp,yp⟩ is given by the Pythagorean theorem as d=√(xp−xc)2+(yp−yc)2. The point ⟨xp,yp⟩ 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 d2 with r2 instead: the point is inside the circle if d2<r2, on the circle if d2=r2, and outside the circle if d2>r2. Thus, you want to compare the number (xp−xc)2+(yp−yc)2 with r2.

**Attribution***Source : Link , Question Author : Ivan , Answer Author : Brian M. Scott*