BRAGA

02 Writing02-02 Notes02-02-177

Circle

Published 16 Apr 20268 min read
Contents
  1. 01Deep Breakdown
  2. 02Flowchart
  3. 03Real-world use
  4. 04The formula, piece by piece
  5. 05The formula in words
  6. 06Critical Concepts
  7. 07Step-by-step calculation (tiny example)
  8. 08Code examples
(x−a)2+(y−b)2=R2(x-a)^2 + (y-b)^2 = R^2
(1)

, A=πr2A = \pi r^2, C=2πrC = 2\pi r

Deep Breakdown

What it tells me (Situation Awareness): Three formulas define the circle in analytic geometry: the equation (x−a)2+(y−b)2=R2(x-a)^2 + (y-b)^2 = R^2 defines the set of all points at distance RR from center (a,b)(a, b); the area A=πR2A = \pi R^2 gives the amount of 2D space enclosed; and the circumference C=2πRC = 2\pi R gives the boundary length. In DA/DS, circles appear as the geometric interpretation of the L2L_2 norm unit ball (the set of all 2D vectors with ∥x∥2=1\|x\|_2 = 1 is the unit circle), as decision boundaries for simple radial classifiers (RBF kernels, KNN in 2D), in geographic analytics (radius of influence, service area radii), and in visualization (pie charts, polar coordinate plots, confidence region boundaries for 2D Gaussian distributions).

Flowchart

Is point (x,y) inside?Is point (x,y) outside?On boundary?Circle: center (a,b), radius REquation: allpoints x,y atdistance R fromcenter(x-a)^2 + (y-b)^2= R^2Area (2D spaceenclosed): A = pi* R^2Circumference(boundarylength): C = 2 *pi * RWhat can I ask?(x-a)^2 + (y-b)^2< R^2 -> inside(x-a)^2 + (y-b)^2R^2 - outside(x-a)^2 + (y-b)^2== R^2 - oncircleDA/DS:confidenceregion area for2D Gaussian (R= sigma)DA/DS:geographicradius of servicearea

Real-world use

Where it is used

Used in geospatial analytics (define a circular catchment area of radius RR around a store or facility), in visualizing 2D confidence regions for bivariate normal distributions (the 1-sigma ellipse reduces to a circle when the two features are uncorrelated and have equal variance), in RBF (radial basis function) kernel methods where the kernel value depends on ∥x−c∥22\|x - c\|_2^2, and in anomaly detection where a circular boundary separates normal from anomalous data in 2D feature space.

Problem it solves

The circle equation gives an analytic definition of "within distance RR from a point," which is the spatial equivalent of the L2L_2 distance check ∥p−c∥2≤R\|p - c\|_2 \leq R. Instead of computing distances for every candidate point, you substitute into the equation and check the inequality. The area formula quantifies the coverage zone; the circumference quantifies the boundary length for routing or perimeter calculations.

How it solves the problem

(x−a)2+(y−b)2=R2(x-a)^2 + (y-b)^2 = R^2 is derived from the Pythagorean theorem: the horizontal distance from center is (x−a)(x-a), the vertical distance is (y−b)(y-b), and their combined Euclidean distance must equal RR. The area πR2\pi R^2 comes from integrating concentric rings ∫0R2πr dr=πR2\int_0^R 2\pi r \, dr = \pi R^2; the circumference 2πR2\pi R is the arc length of the full rotation.

Example in a business

A retail analyst defines a 5-km circular trade area around each of 50 store locations. For each store at coordinates (ai,bi)(a_i, b_i), a customer at (x,y)(x, y) is in the trade area if (x−ai)2+(y−bi)2≤52(x-a_i)^2 + (y-b_i)^2 \leq 5^2. The analyst uses this to count customers per store, compute overlap between trade areas, and estimate total addressable market based on the circular coverage area A=π(5)2≈78.5 km2A = \pi(5)^2 \approx 78.5\ \text{km}^2 per store.

The formula, piece by piece

  • (x−a)2(x-a)^2: the squared horizontal displacement from the center's xx-coordinate aa
  • (y−b)2(y-b)^2: the squared vertical displacement from the center's yy-coordinate bb
  • R2R^2: the squared radius; using R2R^2 avoids a square root and keeps the equation algebraic
  • (a,b)(a, b): the center of the circle; when a=b=0a = b = 0, the circle is centered at the origin
  • A=πR2A = \pi R^2: area enclosed by the circle; grows quadratically with RR
  • C=2πRC = 2\pi R: circumference (perimeter); grows linearly with RR Full formulas: (x−a)2+(y−b)2=R2(x-a)^2 + (y-b)^2 = R^2, A=πR2A = \pi R^2, C=2πRC = 2\pi R

The formula in words

"A circle is the set of all points exactly RR units away from the center (a,b)(a, b). Any point satisfying the equation lies on the boundary; points with a smaller sum are inside; points with a larger sum are outside. The area inside grows as the square of the radius; the boundary length grows linearly." Tiny numeric example: Center (2,3)(2, 3), radius R=5R = 5. Point (6,6)(6, 6): (6−2)2+(6−3)2=16+9=25=52(6-2)^2 + (6-3)^2 = 16 + 9 = 25 = 5^2 — on the circle. Point (3,4)(3, 4): (3−2)2+(4−3)2=1+1=2<25(3-2)^2 + (4-3)^2 = 1 + 1 = 2 < 25 — inside. A=π(25)≈78.54A = \pi(25) \approx 78.54, C=10π≈31.42C = 10\pi \approx 31.42.

Critical Concepts

  • Center-radius form vs general form: (x−a)2+(y−b)2=R2(x-a)^2 + (y-b)^2 = R^2 is the standard form. Expanding gives x2+y2−2ax−2by+(a2+b2−R2)=0x^2 + y^2 - 2ax - 2by + (a^2 + b^2 - R^2) = 0, the general conic form. To go back, complete the square.
  • L2L_2 ball connection: the unit circle is {x∈R2:∥x∥2=1}\{x \in \mathbb{R}^2 : \|x\|_2 = 1\}. Every norm defines a "unit ball"; only the L2L_2 norm gives a circle in 2D.
  • Inscribed vs circumscribed: in spatial analytics, "within radius RR" is ≤R2\leq R^2, "outside" is >R2> R^2.
  • Coordinate system: all distances are in the same units as the coordinate axes. If x,yx, y are in kilometres, RR must be in kilometres.
  • 3D analogue: the sphere (x−a)2+(y−b)2+(z−c)2=R2(x-a)^2 + (y-b)^2 + (z-c)^2 = R^2 with V=43πR3V = \frac{4}{3}\pi R^3.
  • Degenerate cases: R=0R = 0 gives a single point; R<0R < 0 is undefined (no real solutions).

Step-by-step calculation (tiny example)

Step 1: Identify center and radius, write the equation Circle with center (1,−2)(1, -2), radius R=4R = 4. Equation: (x−1)2+(y+2)2=16(x-1)^2 + (y+2)^2 = 16.

Step 2: Check whether specific points are inside, on, or outside Point (1,2)(1, 2): (1−1)2+(2+2)2=0+16=16(1-1)^2 + (2+2)^2 = 0 + 16 = 16 — on the circle. Point (0,0)(0, 0): (0−1)2+(0+2)2=1+4=5<16(0-1)^2 + (0+2)^2 = 1 + 4 = 5 < 16 — inside. Point (5,0)(5, 0): (5−1)2+(0+2)2=16+4=20>16(5-1)^2 + (0+2)^2 = 16 + 4 = 20 > 16 — outside.

Step 3: Compute area and circumference A=π(4)2=16π≈50.27A = \pi(4)^2 = 16\pi \approx 50.27. C=2π(4)=8π≈25.13C = 2\pi(4) = 8\pi \approx 25.13.

Code examples

Beginner example (Python)

python
import numpy as np
import matplotlib.pyplot as plt

# -- Circle: equation, inside/outside check, area, circumference -------
CENTER_X, CENTER_Y, RADIUS = 2.0, 3.0, 5.0

def classify_point(px: float, py: float, cx: float, cy: float, r: float) -> str:
    """Classify a 2D point relative to a circle."""
    dist_sq = (px - cx) ** 2 + (py - cy) ** 2
    r_sq = r ** 2
    if np.isclose(dist_sq, r_sq):
        return "on circle"
    elif dist_sq < r_sq:
        return "inside"
    else:
        return "outside"


test_points = [(6.0, 6.0), (3.0, 4.0), (8.0, 8.0), (2.0, 3.0)]
for pt in test_points:
    status = classify_point(pt[0], pt[1], CENTER_X, CENTER_Y, RADIUS)
    dist_sq = (pt[0] - CENTER_X)**2 + (pt[1] - CENTER_Y)**2
    print(f" Point {pt}: (x-a)^2 + (y-b)^2 = {dist_sq:.1f}, R^2 = {RADIUS**2:.1f} -> {status}")
area = np.pi * RADIUS ** 2
circ = 2 * np.pi * RADIUS
print(f"\nArea (pi*R^2) = {area:.4f}")
print(f"Circumference (2*pi*R) = {circ:.4f}")

Beginner example (R)

r
# -- Circle: equation, inside/outside check, area, circumference -------
CENTER_X <- 2.0; CENTER_Y <- 3.0; RADIUS <- 5.0
classify_point <- function(px, py, cx, cy, r) {
  dist_sq <- (px - cx)^2 + (py - cy)^2
  r_sq <- r^2
  if (isTRUE(all.equal(dist_sq, r_sq))) "on circle"
  else if (dist_sq < r_sq) "inside"
  else "outside"
}
test_points <- list(c(6, 6), c(3, 4), c(8, 8), c(2, 3))
for (pt in test_points) {
  dist_sq <- (pt[1] - CENTER_X)^2 + (pt[2] - CENTER_Y)^2
  status <- classify_point(pt[1], pt[2], CENTER_X, CENTER_Y, RADIUS)
  cat(sprintf(" Point (%.0f, %.0f): dist^2 = %.1f, R^2 = %.1f -> %s\n", pt[1], pt[2], dist_sq, RADIUS^2, status))
}
area <- pi * RADIUS^2
circ <- 2 * pi * RADIUS
cat(sprintf("\nArea (pi*R^2) = %.4f\n", area))
cat(sprintf("Circumference (2*pi*R) = %.4f\n", circ))

Professional example (Python)

python
import numpy as np
import pandas as pd
np.random.seed(42)

# -- Business scenario: retail trade area overlap analysis
# 5 store locations, each with a 5-km circular trade area.
# Count customers falling in each store's area; flag overlapping catchments.
N_STORES = 5
N_CUSTOMERS = 2000
TRADE_RADIUS = 5.0   # km

# Store locations (lat/lon approximated as km offsets from city center)
store_coords = np.array([
    [ 0.0,  0.0],   # downtown
    [ 4.0,  3.0],   # north-east
    [-4.0,  2.0],   # north-west
    [ 3.0, -4.0],   # south-east
    [-2.0, -5.0],   # south
])

# Simulate customer locations (clustered around city center)
customer_coords = np.random.normal(0, 4.0, size=(N_CUSTOMERS, 2))

# For each store, count customers within trade area
results = []
for store_idx, (cx, cy) in enumerate(store_coords):
    dist_sq = (customer_coords[:, 0] - cx)**2 + (customer_coords[:, 1] - cy)**2
    in_area = dist_sq <= TRADE_RADIUS**2
    n_in_area = int(np.sum(in_area))
    coverage_a = np.pi * TRADE_RADIUS**2
    results.append({
        "store_id": store_idx + 1,
        "center_x_km": cx,
        "center_y_km": cy,
        "customers_in_area": n_in_area,
        "coverage_area_km2": round(coverage_a, 2),
        "customer_density": round(n_in_area / coverage_a, 4),
    })
df = pd.DataFrame(results)
print(f"Trade radius: {TRADE_RADIUS} km | Coverage area per store: {np.pi*TRADE_RADIUS**2:.2f} km^2")
print(f"\nStore trade area summary:")
print(df.to_string(index=False))

# Check pairwise overlap: two circles overlap if distance between centers < 2R
print(f"\nPairwise overlap check (circles overlap if center distance < 2*R = {2*TRADE_RADIUS:.1f} km):")
for i in range(N_STORES):
    for j in range(i + 1, N_STORES):
        d = float(np.linalg.norm(store_coords[i] - store_coords[j]))
        overlap = d < 2 * TRADE_RADIUS
        print(f" Store {i+1} <-> Store {j+1}: center dist = {d:.2f} km -> {'OVERLAP' if overlap else 'no overlap'}")

Source: 1300 p. 157

#linear-algebra#spatial-distance-norms-and-analytic-geometry#analytic-geometry-shapes-perimeter-area-volume

Keyboard shortcuts

Single keys, ignored while typing in a field or with Cmd, Ctrl or Alt held.

0
Home
1 2 3 4
Work, Writing, Tools, About
j / k
Next / previous section on this page
n / p
Next / previous project or essay
u
Up one level
l
Deutsch
t
Light or dark theme
?
This list
Esc
Close