This is a question in the spirit of [an earlier problem](https://mathoverflow.net/questions/312708/a-link-between-hooks-contents-and-parts-of-a-partition). 


Let $\lambda$ be an integer partition: $\lambda=(\lambda\_1\geq\lambda\_2\geq\dots\geq0)$. 


Recall also the notation for the content of a cell $u=(i,j)$ in a partition: $c\_u=j−i$. Further, let $h\_u$ denote the [hook-length](https://en.wikipedia.org/wiki/Hook_length_formula#Example) of the cell $u$.


The below identity is rather cute for which I don't remember a reference or a proof, so here I ask.



> 
> **Identity.** Given a partition $\lambda\vdash n$, it holds that
>  $$\sum\_{u\in\lambda}h\_u^2=n^2+\sum\_{u\in\lambda}c\_u^2.$$
> 
> 
> 


For example, if $\lambda=(4,3,1)\vdash 8$ then the hooks are $\{6,4,3,1,4,2,1,1\}$ and the contents are $\{0,1,2,3,-1,0,1,-2\}$. Hence
\begin{align}
LHS=6^2+4^2+3^2+1^2+4^2+2^2+1^2+1^2&=84 \\
RHS=\mathbf{8^2}+0^2+1^2+2^2+3^2+(-1)^2+0^2+1^2+(-2)^2&=84.
\end{align}



A link between hooks and contents: Part II
You can also prove this inductively by adding boxes to outside corners of $\lambda$.


Suppose the result is true for $\lambda\vdash n$ and then we add a new box $(i,j)$ in an outside corner. 


The RHS increases by $(n+1)^2-n^2 + (i-j)^2=2n+1+(i-j)^2$


How much does the LHS increase by? Let me use $h\_u$ for the hook length of $u$ in $\lambda$ (as opposed to the hook length in $\lambda + (i,j)$.)


We increase the hook length by one for every $u$ in the same row or same column as $(i,j)$. So for each of these boxes $u$ we increase the squared hook length by $2h\_u+1$.


Note that
$$ \sum\_{\substack{u \textrm{ in same row } \\\textrm{or column as $(i,j)$}}}h\_u = n-(i-1)\times(j-1) +(0+1+...+i-2)+(0+1+...+j-2)$$
because every box not in the $(i-1)\times(j-1)$ northwest rectangle of $\lambda$ is covered exactly once by the hooks in this row or column, except that the boxes in this row or column are covered many extra times as accounted for by those arithmetic progressions. 


Thus the LHS increases by
$$ 2(n-(i-1)(j-1)+(i-1)(i-2)/2+(j-1)(j-2)/2)+(i-1)+(j-1)+1$$
(where that last $+1$ is for the hook length of $(i,j)$), and this indeed equals
$2n+1+(i-j)^2$.


