Is there an analog of the Law of Cosines that applies to polyhedra? Is there a relationship between the side areas of a polyhedron $A_1, A_2, \ldots, A_n$ similar to the law of cosines for triangles?
 A: Yes, there is! It is as follows, where $\theta_{jk}$ represents the dihedral angle between pairs of sides of the polygon.
$$A_n^2 = A_1^2 + A_2^2 + \cdots + A_{n-1}^2 - \sum_{k=2}^{n-1}\sum_{j < k} 2A_j A_k \cos \theta_{jk}$$
A proof of this statement is below.

Lemma. Given an arbitrary $n$-sided polyhedron $P$ in three-dimensional space with sides of oriented vector areas $\mathbf A_1, \mathbf A_2, \ldots, \mathbf A_n$, we have $$\mathbf A_1 + \mathbf A_2 + \cdots + \mathbf A_n = \mathbf 0$$
Proof. Consider the constant vector field $\mathbf F_{\mathbf v}(\mathbf x) = \mathbf v$, where $\mathbf x, \mathbf v \in \mathbb R^3$. The flux of a non-divergent vector field across any closed shape is zero. So, the flux $\Phi$ of $\mathbf F_{\mathbf v}$ across $P$ should also be zero. This gives $$0 = \Phi = \oint_P \mathbf F_{\mathbf v} \cdot d\mathbf A = \mathbf A_1 \cdot \mathbf v + \mathbf A_2 \cdot \mathbf v + \cdots + \mathbf A_n \cdot \mathbf v,$$
$$\forall \mathbf v \in \mathbb R^3 : \left( \mathbf A_1 + \mathbf A_2 + \cdots + \mathbf A_n\right) \cdot \mathbf v = 0$$
Since this is true for all vectors $\mathbf v$, it must be the case that $\mathbf A_1 + \mathbf A_2 + \cdots + \mathbf A_n$ vanishes.

Theorem (Law of Cosines for Polyhedra). If we write $A_i \equiv |\mathbf A_i|$ for all $i$, and $\theta_{jk}$ represents the dihedral angle between sides $\mathbf A_j$ and $\mathbf A_k$, then the following relationship holds.
$$A_n^2 = A_1^2 + A_2^2 + \cdots + A_{n-1}^2 - \sum_{k=2}^{n-1}\sum_{j < k} 2A_j A_k \cos \theta_{jk}$$
Proof. By the lemma, we have
$$\mathbf A_n = -(\mathbf A_1 + \mathbf A_2 + \cdots + \mathbf A_{n-1}).$$
Since $\forall i : A_i^2 = \mathbf A_i \cdot \mathbf A_i$, we have
$$A_n^2 = (\mathbf A_1 + \mathbf A_2 + \cdots + \mathbf A_{n-1}) \cdot (\mathbf A_1 + \mathbf A_2 + \cdots + \mathbf A_{n-1})$$
$$A_n^2 = \sum_{j = 1}^{n-1} \sum_{k=1}^{n-1} \mathbf A_i \cdot \mathbf A_j$$
Let $\varphi_{jk}$ be the angle between the vectors $\mathbf A_j$ and $\mathbf A_k$.
$$A_n^2 = \sum_{j = 1}^{n-1} \sum_{k=1}^{n-1} A_i A_j \cos \varphi_{jk}$$
Note that $\varphi_{jk} = \pi - \theta_{jk}$, which gives $\cos \varphi_{jk} = -\cos \theta_{jk}$. Additionally, when $j = k$, we have $\varphi_{jk} = 0$, so $\cos \varphi_{jk} = 1$.
$$A_n^2 = A_1^2 + A_2^2 + \cdots + A_{n-1}^2 - \sum_{j = 1}^{n-1} \sum_{\substack{k=1 \\ k \ne j}}^{n-1} A_i A_j \cos \theta_{jk}$$
Grouping like terms and reassigning index values accordingly completes the proof.
$$A_n^2 = A_1^2 + A_2^2 + \cdots + A_{n-1}^2 - \sum_{k=2}^{n-1}\sum_{j < k} 2A_j A_k \cos \theta_{jk}$$
Q.E.D.
