2 Computing the Maximum of Five Inputs
For \(x\in \mathbb {R}^5\), define
Equivalently,
For \(x\in \mathbb {R}^5\), define
equivalently
For \(x\in \mathbb {R}^5\), define
equivalently
For \(x\in \mathbb {R}^5\), define
equivalently
For \(x\in \mathbb {R}^5\), define
For \(x\in \mathbb {R}^5\), define
Thus \(R_{13}(x)=\max (2x_5,x_1+x_3,x_1+x_2,x_3+x_4)\).
For \(x\in \mathbb {R}^5\), define
Thus \(R_{14}(x)=\max (2x_5,x_1+x_4,x_1+x_2,x_3+x_4)\).
For \(x\in \mathbb {R}^5\), define
Thus \(R_{23}(x)=\max (2x_5,x_2+x_3,x_1+x_2,x_3+x_4)\).
For \(x\in \mathbb {R}^5\), define
Thus \(R_{24}(x)=\max (2x_5,x_2+x_4,x_1+x_2,x_3+x_4)\).
Define \(M:\mathbb {R}^5\to \mathbb {R}\) by
Every displayed term is obtained from affine functions by first computing a finite list of binary maxima and then taking one final binary maximum between affine combinations of the first-layer quantities. For example, \(P_1\) first computes \(\max (2x_5,x_1+x_2)\), \(\max (x_1,x_3)\), and \(\max (x_1,x_4)\), and then computes the maximum of the first quantity and the sum of the latter two. The other eight terms have the same form, with some summands omitted. By Lemma 9, each binary maximum costs one hidden layer, and affine sums are handled by affine maps between layers. Hence each term has depth two.
The expression \(M\) is invariant under swapping indices \(1\) and \(2\), under swapping indices \(3\) and \(4\), and under simultaneously swapping the pair \((1,2)\) with the pair \((3,4)\).
Under \(1\leftrightarrow 2\), the terms \(P_1\) and \(P_2\) are exchanged, \(R_{13}\) and \(R_{23}\) are exchanged, and \(R_{14}\) and \(R_{24}\) are exchanged; \(P_3\), \(P_4\), and \(Q\) remain fixed. Under \(3\leftrightarrow 4\), the terms \(P_3\) and \(P_4\) are exchanged, \(R_{13}\) and \(R_{14}\) are exchanged, and \(R_{23}\) and \(R_{24}\) are exchanged; the other terms remain fixed. Under \((1,2)\leftrightarrow (3,4)\), the terms \(P_1\) and \(P_3\) are exchanged, \(P_2\) and \(P_4\) are exchanged, and \(R_{14}\) and \(R_{23}\) are exchanged; the remaining terms are fixed. Since \(M\) is the same signed half-sum of the resulting multiset of terms, \(M\) is invariant under all three operations.
If \(x_5=\operatorname {MAX}_5(x)\), then \(M(x)=x_5\).
If \(x_5\) is the largest coordinate, then for every pair \(i,j\) one has \(x_i+x_j\le 2x_5\). Inspecting the displayed maxima in the definitions of \(P_1,P_2,P_3,P_4,Q,R_{13},R_{14},R_{23},R_{24}\), each of the nine terms is therefore equal to \(2x_5\). Substitution in Definition 24 gives
If \(x_1=\operatorname {MAX}_5(x)\), then \(M(x)=x_1\).
Since \(x_1\) is largest, \(2x_1\) dominates all entries in \(P_1\), so \(P_1(x)=2x_1\). Also \(x_1+x_2\ge 2x_2\) and \(x_1+x_2\ge x_2+x_4\), hence
Similarly, \(x_1+x_3\ge 2x_3\) and \(x_1+x_3\ge x_2+x_3\), so
Likewise \(x_1+x_4\ge 2x_4\) and \(x_1+x_4\ge x_2+x_4\), giving
Finally \(x_1+x_2\ge x_2+x_4\), so
In the signed half-sum defining \(M\), the equal pairs \(P_2=R_{23}\), \(P_3=R_{13}\), \(P_4=R_{14}\), and \(Q=R_{24}\) cancel. Therefore \(M(x)=\frac12P_1(x)=x_1\).
For every \(x\in \mathbb {R}^5\), \(\operatorname {MAX}_5(x)=M(x)\).
If \(x_5\) is a largest coordinate, Lemma 27 applies. Otherwise some coordinate among \(x_1,x_2,x_3,x_4\) is largest. By the symmetries of Lemma 26, the four cases with a largest coordinate in \(\{ 1,2,3,4\} \) reduce to the case \(x_1=\operatorname {MAX}_5(x)\), which is Lemma 28. Hence \(M\) agrees with \(\operatorname {MAX}_5\) on all inputs.
The minimum number of hidden layers needed to compute \(\operatorname {MAX}_5\) is exactly two.
The upper bound follows because each of the nine terms in Definition 24 is computable with two hidden layers by Lemma 25, and \(M\) is an affine combination of those terms. By Lemma 29, this computes \(\operatorname {MAX}_5\). For the lower bound, if \(\operatorname {MAX}_5\) had a one-hidden-layer representation, then restricting to the affine subspace \((x_1,x_2,x_3,x_4,x_5)=(y_1,y_2,y_3,c,c)\) with \(c\) smaller than all relevant \(y_i\) on each translated test region would give a one-hidden-layer representation of \(\operatorname {MAX}_3\). This contradicts Lemma 14. Therefore one hidden layer does not suffice, while two do.