Explanation of several remarks of Gauss on representations of a given number as sum of four squares. Remark 1: On p.384 of volume 3 of Gauss's Werke, which is a part of an unpublished treatise on the arithmetic geometric mean, Gauss makes the following remark:

On the theory of the division of numbers into four squares:
The theorem that the product of two sums of four squares is itself a sum of four squares, is most simply represented as follows: let $l,m,\lambda,\mu,\lambda',\mu'$ be six complex numbers such that $\lambda,\lambda'$ and $\mu,\mu'$ are conjugate. Let $N$ denote the norm, than $$(Nl+Nm)(N\lambda + N\mu)=N(l\lambda+m\mu)+N(l\mu'-m\lambda')$$ and also $$(N(n+in')+N(n''+in'''))(N(1-i)+N(1+i))=N((n+n'+n''-n''')+i(-n+n'+n''+n'''))+N((n+n'-n''+n''')-i(n-n'+n''+n'''))$$
From this it is easy to derive the following two propositions, in which different representation of a number by a sum of four squares refer to the different value systems of the four roots, taking into account both the signs and the sequence of the roots. 1. If the fourfold  of a number of the form $4k+1$ can be represented by four odd squares, then it can be represented half as often by one odd and three even squares, and vice versa, if a number can be represented in this way, that it can be represented twice as often in the first way. 2. If the fourfold of a number of the form $4k+3$ can be represented by four odd squares, then it can be represented half as often by one even and three odd squares, and vice versa, if a number can be represented in this way, than its quadruple can be represented twice as often in the first way.

Gauss than says that a certain identity of theta functions can be derived by these two theorems, namely the assertion (written here in modern notation):
$$\vartheta_{00}(0;\tau)^4 = \vartheta_{01}(0;\tau)^4 + \vartheta_{10}(0;\tau)^4$$
(Gauss denotes the three theta functions by $p(y),q(y),r(y)$).
Notes on remark 1:

*

*The first identity in this passage was verifed algebrically by me, and I also suspect it might be intimately connected with quaternions.

*The second identity follows directly from the first by substituting $\lambda = 1-i$ and $\mu = 1+i$. Since $N(1-i)+N(1+i)=4$, this identity enables one to generate new representations of an integer $4s$ as sum of four squares by simply changing the signs and order of the different numbers in the representation of $s$ as sum of four squares. For example, if $s = 13 = 2^2+2^2+2^2+1^2$ than this identity implies $52=4s = 5^2+3^2+3^2+3^2$.

Remark 2: On p. 1-2 of volume 8 of Gauss's Werke there is an additional note on the representation of numbers as sums of squares. According to Dickson's "history of the theory of numbers":

Gauss noted that every decomposition of a multiple of a prime $p$ into $a^2+b^2+c^2+d^2$ corresponds to a solution of $x^2+y^2+z^2\equiv 0 \pmod{p}$ proportional to $a^2+b^2,ac+bd,ad-bc$ or to the sets derived by interchanging $b$ and $c$ or $b$ and $d$. For $p\equiv 3 \pmod{4}$, the solutions of $1+x^2+y^2\equiv 0 \pmod{p}$ coincide with those of $1+(x+iy)^{p+1}\equiv 0$. From one value of $x+iy$ we get all by using: $$(x+iy)\frac{(u+i)}{(u - i)}$$ (where $u = 0,1,\cdots, p-1$). For $p\equiv 1 \pmod{4}, p = a^2+b^2$; then $b\frac{(u+i)}{a(u-i)}$ give all values of $x+iy$ if we exclude the values $a/b$ and $b/a$ of $u$.

Why is this interesting?
The reason why these passages interests me is that it might give a clue of answering a previous question I posted on math stack exchange Did Gauss know Jacobi's four squares theorem?.
Since these remarks show how to generate new resolutions into four squares in terms of known resolutions, Gauss seems to have developed an enumarting argument (of the amount of representations of a given number as a sum of four squares) in those remarks, an argument which might have guided him in the developement of the identity for the generation function of $\vartheta_{00}(0;\tau)^4$ (an identity which leads to Jacobi's four squares theorem); this generating function appears in p. 445 of volume 3 of his works, but with no specific reference to sums of four squares.
Questions

*

*The two propositions which Gauss mentions in remark 1 are unclear to me, and I mean that the propositions themself are unclear, not their derivation. It is simply not formulated clearly. Therefore, I'd like to get an explanation of the two propositions which Gauss mentions.

*I'd also like to understand how the theta function identity follows from the two propositions.

*What is the meaning of the results in remark 2? they are very complicated and i don't have a clue of understanding its meaning.

 A: I use the following notation in what follows:
\begin{align}
\vartheta_2(q) &=\sum_{n\in\mathbb {Z}} q^{(n+(1/2))^2}\tag{1a}\\
\vartheta_3(q) &=\sum_{n\in\mathbb {Z}} q^{n^2}\tag{1b}\\
\vartheta_4(q) &=\vartheta_3(-q)\tag{1c}
\end{align}
Let $a(n) $ be the number of ways in which the positive integer $n$ can be expressed as sum of four squares. Then we have $$\vartheta_3 ^4(q)=1+\sum_{n=1}^{\infty} a(n) q^n\tag{2}$$
Let $b(n) $ represents the number of ways of expressing $n$ as a sum of four odd squares. Then $$\vartheta_2^4(q^4)=\sum_{n=1}^{\infty} b(n) q^n\tag{3}$$ Since $$\vartheta_2(q)=2q^{1/4}\sum_{n=1}^{\infty} q^{n(n+1)}$$ it follows that $$\vartheta_2^4(q)=16q\left(\sum_{n=1}^{\infty} q^{n(n+1)}\right)^4$$ and $\vartheta_2^4(q)$ is an odd function of $q$.
Hence we can rewrite $(3)$ as $$\vartheta_2^4(q^4)=\sum_{n=0}^{\infty} b(4(2n+1))q^{4(2n+1)}$$ or $$\vartheta_2^4(q)=\sum_{n=0}^{\infty} b(4(2n+1))q^{2n+1}\tag{4}$$ Next we can observe (using $(1c),(2)$) that $$\vartheta_4 ^4(q)=1+\sum_{n=1}^{\infty} (-1)^na(n)q^n\tag{5}$$ Therefore the coefficients of even powers of $q$ in $\vartheta_3^4(q),\vartheta_4 ^4(q)$ are equal and for odd powers of $q$ they differ in sign.
Now consider the target identity $$\vartheta_3 ^4(q)=\vartheta_2^4(q)+\vartheta_4^4(q)\tag{6}$$ which needs to be established. The first term on right side is an odd function and contains only odd powers of $q$. And we have noted that the coefficients of even powers of $q$ match on both sides. Thus our job is done if we can match the coefficients of odd powers of $q$ ie $$a(2n+1)=b(4(2n+1))-a(2n+1)$$ or $$b(4(2n+1))=2a(2n+1)\tag{7}$$ Next we observe that if an odd number $(2n+1)$ can be expressed as sum of four squares then either the expression consists of one odd square and three even squares or it consists of one even and three odd squares. Also the first case arises when $2n+1=4k+1$ and the second case arises when $2n+1=4k+3$.
For both these cases Gauss makes claims in his remark 1 and says that $$b(4(4k+1))=2a(4k+1),b(4(4k+3))=2a(4k+3)\tag{8}$$ which is same as identity $(7)$ and hence $(6)$ is established if we assume that both propositions in remark 1 are true.
