Sum of Squares and Factorial – Is There a Hidden Relation?

elementary-number-theoryfactorialsums-of-squares

Is there a hidden relation between the sum of squares and the factorial?

Two cases will be considered: the sum of odd squares and that of the even squares. We will not consider the classical sum of odd and even squares given by:

Case 1: $1^2 +3^2 +5^2+\cdots+(2n+1)^2 = N$
Case 2: $2^2 +4^2 +6^2+\cdots+(2n)^2 = M$

Instead, we will consider the sum of odd squares given by adding numbers starting with an odd number and and on the perpendicular to the main diagonal ( that of the squares themselves ) in the multiplication table. Here are two examples to clarify what is meant.

Case 1: $3 + 4 + 3 = 10 = 1^2 + 3^2$
Case 2: $5 + 8 + 9 + 8 + 5 = 35 = 1^2 + 3^2 + 5^2$

It's clear that if a diagonal start with an odd number, the sum of these numbers will provide the sum of odd squares. The same can be said if the starting number is an even number. Here are two examples to show how this works.

Case 1: $4 + 6 + 6 + 4 = 20 = 2^2 + 4^2$
Case 2: $8 + 14 + 18 + 20 + 20 + 18 + 14 + 8 = 120 = 2^2 + 4^2 + 6^2 +8^2$

Factorial $N$ can be calculated using the same numbers given above. If the starting number of a diagonal is odd, then the result of the multiplication of the numbers will give the factorial of that $(N!)^2$. The same thing applies to even starting numbers.

Case 1: $(5!)^2= 5\cdot8\cdot9\cdot8\cdot5= 120^2 = (5\cdot8\cdot3)\cdot(3\cdot8\cdot5)$
Case 2: $(6!)^2= 6\cdot10\cdot12\cdot12\cdot10\cdot6= 720^2 = (6\cdot10\cdot12)\cdot(12\cdot10\cdot6)$

The sum of squares, odd or even, is given by simple addition of the numbers located on the diagonal to the main diagonal of the multiplication table but the factorial is the product of these same numbers. There is a simple way to calculate $N!$ instead of $(N!)^2$.

I found the fact that the same numbers are used to calculate the sum of squares and a factorial odd and I am wondering if there is a hidden relation between the two.

Edit March 23 2023

How to express factorials as a product of difference of squares formed with the (partial) sum of squares numbers. However, the link to the sum of squares is no longer visible.

Example of $20!$

$20!=20\cdot38\cdot54\cdot68\cdot80\cdot90\cdot98\cdot104\cdot108\cdot110$.
We pair them two at a time to get the following result:

$20!=(29^2-9^2)(61^2-7^2)(85^2-5^2)(101^2-3^2)(109^2-1^2)$

$(109^2-1^2)$ is simply $109=(108+110)/2$ and $1=(110-108)/2$.

The subtracted squares values are determined by the distance to the main diagonal (of squares). We only have odd numbers square for the differences because of the pairing which skips some multiplications (like $38\cdot54$ because both are paired with other numbers).
I am not sure if the square form of the factorials is faster but it could be advantageous with the use of pre-stored squares.
With odd numbers and even numbers like $14$ which when divided by $2$ give an odd number, there is always one number that cannot be paired.

Best Answer

We start with a small example $2n+1=7$. Then we prove the formulas in the additive and multiplicative case for general odd positive numbers $2n+1$. We will then compare the tables and the proofs to see if there are some commonalities.

Additive case: $n=7$: \begin{align*} \begin{array}{rrrrrrr|r} 7&+12&+15&+16&+15&+12&+7\\ \hline =7&+7&+7&+7&+7&+7&+7&=7\cdot 7\\ &+5&+5&+5&+5&+5&&+5\cdot 5\\ &&+3&+3&+3&&&+3\cdot 3\\ &&&+1&&&&+1\cdot1 \end{array} \end{align*} The table above shows how the summands in the first row can be split into equal parts of odd numbers so that the sum of these equal parts is a square number given in the rightmost column.

In general we obtain \begin{align*} \color{blue}{\sum_{j=-n}^n}\color{blue}{\sum_{k=0}^{n-|j|}(2n+1-2k)} &=\sum_{{-n\le j\le n}\atop{0\le k\le n-|j|}}(2n+1-2k)\tag{1.1}\\ &=\sum_{{0\le k\le n}\atop{0\le |j|\le n-k}}(2n+1-2k)\tag{1.2}\\ &=\sum_{k=0}^n\sum_{j=-n+k}^{n-k}(2n+1-2k)\tag{1.3}\\ &=\sum_{k=0}^n(2n+1-2k)^2\tag{1.4}\\ &\,\,\color{blue}{=\sum_{k=0}^n(2k+1)^2}\tag{1.5} \end{align*}

Comments:

  • In (1.1) we write the index region a bit more conveniently to better seethe transformations which follow.

  • In (1.2) we change the order of summation starting with $k$.

  • In (1.3) we use two summation symbols again.

  • In (1.4) we see the summands do not depend on $j$.

  • In (1.5) we change the order of summation $k\to n-k$.

Multiplicative case $2n+1=7$:

Now we take a look at the multplicative case and start again with a small table.

\begin{align*} \begin{array}{ccccccc} 7&\cdot 12&\cdot 15&\cdot 16&\cdot 15&\cdot 12&\cdot 7\\ \hline =(7)&\cdot(7+5)&\cdot(7+5+3)&\cdot(7+5+3+1)&\cdot(7+5+3)&\cdot(7+5)&\cdot(7)\\ =(7)&\cdot(6+6)&\cdot(5+5+5)&\cdot(4+4+4+4)&\cdot(5+5+5)&\cdot(6+6)&\cdot(7)\\ =(7)&\cdot(2\cdot 6)&\cdot(3\cdot 5)&\cdot(4\cdot4)&(3\cdot 5)&\cdot(2\cdot 6)&\cdot(7)\\ \end{array} \end{align*} The rearrangements in the table above are significantly different compared with the additive case. Here are the arrangements within each factor of the first row only.

In general we take again odd positive numbers $2n+1$ and consider \begin{align*} \color{blue}{\prod_{j=-n}^n\sum_{k=0}^{n-|j|}(2n+1-2k)} \end{align*} We observe in case $2n+1=7$ the greatest factor $16=7+5+3+1$ has four summands. It is convenient to split the calculation into $n=2m$ and $n=2m+1$ and perform the calculation for even and odd number of summands of the greatest factor separately. Here we consider the even case $n=2m$ only. The odd case can be calculated similarly.

We have \begin{align*} \color{blue}{\prod_{j=-2m}^{2m}\sum_{k=0}^{2m-|j|}(4m+1-2k)}\tag{2.1} \end{align*} Since the calculation of the inner sum of (2.1) is a bit different depending on the parity of $j$, we consider two cases.

Case $|j|=2q$: We obtain

\begin{align*} \color{blue}{\sum_{k=0}^{2m-2q}}&\color{blue}{(4m+1-2k)}\\ &=\sum_{k=0}^{m-q-1}((4m+1-2k)+(4m+1-2(2m-2q-k))\\ &\qquad\qquad+4m+1-2(m-q)\tag{2.2}\\ &=\sum_{k=0}^{m-q-1}(4m+4q+2)+(2m+2q+1)\\ &=2\sum_{k=0}^{m-q-1}(2m+2q+1)+(2m+2q+1)\\ &=(2m-2q+1)(2m+2q+1)\tag{2.3}\\ &=(2m-|j|+1)(2m+|j|+1)\\ &\,\,\color{blue}{=(2m-j+1)(2m+j+1)}\tag{2.4} \end{align*}

Comments:

  • In (2.2) we rearrange the $2m-2q+1$ terms and separate the middle term from the sum.

  • In (2.3) we see the summands do not depend on the index $k$.

Case $|j|=2q+1$: This case can be calculated analogously resulting in \begin{align*} \color{blue}{\sum_{k=0}^{2m-2q-1}(4m+1-2k)}&=(2m-2q)(2m+2q+2)\\ &\,\,\color{blue}{=(2m-j+1)(2m+j+1)}\tag{2.5} \end{align*}

From (2.1),(2.4) and (2.5) we derive for $n=2m$:

\begin{align*} \color{blue}{\prod_{j=-2m}^{2m}}&\color{blue}{\sum_{k=0}^{2m-|j|}(4m+1-2k)}\\ &=\prod_{j=-2m}^{2m}(2m-j+1)(2m+j+1)\\ &=\prod_{j=-2m}^{2m}(2m+j+1)^2\\ &=\prod_{j=0}^{4m}(j+1)^2\\ &\,\,\color{blue}{=((4m+1)!)^2} \end{align*}

Conclusion: Both, the different rearrangements of the tables for the special case, as well as the different derivations of the general formulas rather indicate that there is no hidden relationship between the formulas in the additive and in the multiplicative case. Here it seems we have independent formulas showing us some nice properties of odd positive numbers.

Related Question