TITLE: Geometric meaning of a trigonometric identity
QUESTION [15 upvotes]: It follows from the law of cosines that if $a,b,c$ are the lengths of the sides of a triangle with respective opposite angles $\alpha,\beta,\gamma$, then
$$
a^2+b^2+c^2 = 2ab\cos\gamma + 2ac\cos\beta + 2bc\cos\alpha.
$$
For a cyclic (i.e. inscribed in a circle) polygon, consider the angle "opposite" a side to be the angle between adjacent diagonals whose endpoints are those of that side (it doesn't matter which vertex of the polygon serves as the vertex of that angle).  Then for a cyclic quadrilateral with sides $a,b,c,d$ and opposite angles $\alpha,\beta,\gamma,\delta$, one can show that
\begin{align}
a^2+b^2+c^2+d^2 = {} & 2ab\cos\gamma\cos\delta + 2ac\cos\beta\cos\delta + 2ad\cos\beta\cos\gamma \\
& {} +2bc\cos\alpha\cos\delta+2bd\cos\alpha\cos\gamma+2cd\cos\alpha\cos\beta \\
& {}-4\frac{abcd}{(\text{diameter})^2}
\end{align}
And for a cyclic pentagon, with sides $a,b,c,d,e$ and respective opposite angles $\alpha,\beta,\gamma,\delta,\varepsilon$,
\begin{align}
a^2 + \cdots + e^2 = {} & 2ab\cos\gamma\cos\delta\cos\varepsilon+\text{9 more terms} \\
& {} - 4\frac{abcd}{(\text{diameter})^2}\cos\varepsilon+ \text{4 more terms}.
\end{align}
And for a cyclic $n$-gon with sides $a_i$ and opposite angles $\alpha_i,$
\begin{align}
\sum_{i=1}^n a_i^2 = {} & \text{a sum of }\binom{n}{2}\text{ terms each with coefficient 2} \\
& {} - \text{a sum of }\binom{n}{4}\text{ terms each with coefficient 4} \\
& {} + \text{a sum of }\binom{n}{6}\text{ terms each with coefficient 6} \\
& {} - \cdots \text{ and so on}
\end{align}
The number of terms depends on $n$ and the power of the diameter on the bottom is in each case what is needed to make the term homogeneous of degree 2 in the side lengths ("dimensional correctness" if you like physicists' language), and the alternation of signs continues.
I showed this by induction.  It should work for infinitely many sides, too, by taking limits.  Each term would then have a product of infinitely many cosines.
My question is: Is there some reasonable geometric interpretation of the sum of squares of sides of a polygon inscribed in a circle?
Later note:The question was in part inspired by a similar situation in which there is a simple geometric interpretation of the right side of the identity.  That looks like this:

$$
\begin{align}
& 2\left(\frac{abc}{\text{diameter}}\cos\delta\cos\gamma\cos\zeta\cos\eta\cdots\right) + \text{all other terms with 3 sides} \\
& {} - 4 \left( \frac{abcde}{(\text{diameter})^3} \cos\zeta\cos\eta\cdots \right) + \text{other terms with 5 sides} \\
& {} + 6 \left(\text{similarly with 7}\right) - 8(\text{similarly with 9}) + \cdots
\end{align}
$$

That's one side of the identity.  The other is
$$
\text{diameter}\cdot (a\cos\alpha + b\cos\beta + c\cos\gamma + \cdots).
$$
The expression on both sides is 4 times the area of the polygon.  That's the simple geometric interpretation.  The terms on the "other" side of the identity are signed areas of triangles with a vertex at the center of the circle.  Notice that at most one of the cosines can be negative, and that happens precisely if the center of the circle is not in the interior of the polygon.

REPLY [16 votes]: I don't know of a "reasonable geometric interpretation of the sum of squares of sides of a polygon inscribed in a circle".  I do, however, find a proof without explicit induction that to some extent explains the formula, and may be simpler than the proof of original proposer (OP), so it might be of some interest to some readers and perhaps also the OP.  It is not simple enough to fit in a comment so I must post it as an answer.
By homogeneity we may assume the circle has diameter 1, which will simplify the formulas.  I'll use $j$ rather than $i$ for the index because I'll need $i$ to be $\sqrt{-1}$.
Each $a_j$ is the side of a right triangle with hypotenuse 1 and opposite angle $\alpha_j$.  Hence $a_j = \sin \alpha_j$, and the left-hand side is $\sum_{j=1}^n a_j^2$.
Each term in the sum on the right-hand side, call it $S$, is $-\prod_{j=1}^n \cos \alpha_j$ times $(-1)^{k/2} k$ times a product of $k$ factors $a_j / \cos \alpha_j = \tan \alpha_j$ with distinct $j$'s, for some even integer $k>0$.  We might as well include $k=0$ because then $(-1)^{k/2} k = 0$.
To access this sum, consider the finite generating function (or generating polynomial)
$$
P(X) := \prod_{j=1}^n (1 + i \tan \alpha_j \cdot X). 
$$
Expand, sum the coefficients, and take the real part.  That almost matches $-S$, except that the $X^k$ coefficients are missing the factor $k$.  To get that factor, differentiate and set $X=1$:
$$
-S = \left(\prod_{j=1}^n \cos \alpha_j \right) {\rm Re}\left( P\phantom{|}'(X)|_{X=1}\right) 
=\left(\prod_{j=1}^n \cos \alpha_j \right) {\rm Re}\left( P(1) \phantom{/}\sum_{j=1}^n \frac{i \tan \alpha_j}{1 + i \tan \alpha_j \cdot X} \Biggl|_{X=1}\Biggr.\right).
$$
But $P(1)$ is the product of terms $1+i\tan\alpha_j = e^{i \alpha_j} / \cos \alpha_j$, and (aha) $\sum_j \alpha_j = \pi$ because each $\alpha_j$ is half the angle subtended by the $j$-th side about the center of the circle.  Hence $P(1)$ is the real number $-1 / \prod_{j=1}^n \cos \alpha_j$, and $S$ simplifies to
$$
+ \sum_{j=1}^n  \phantom| {\rm Re} \frac{i \tan \alpha_j}{1 + i \tan \alpha_j} 
= \sum_{j=1}^n \phantom| \frac{\tan^2 \alpha_j} {1+\tan^2 \alpha_j}
= \sum_{j=1}^n \phantom| \sin^2 \alpha_j,
$$
QED.