sum of trace for representations of finite groups Recently I am reading something about trace formula, and I want to prove Frobenius reciprocity from trace formula for a finite group. And I come across the following two formulas which I can't prove.
Assume $G$ is a finite group, and $(\pi,V)$ is a representation of $G$. Let $V^G$ be the subspace of $V$ consisted of elements which are fixed by $g$ for all $g\in G$. Then I want to know if we can prove
$$\sum_{g\in G}\operatorname{tr}(\pi(g))=|G|\dim V^G.$$
Moreover, for any $\gamma\in G$, let
$$G_\gamma=\{g\in G丨g\gamma=\gamma g\},$$
and $S$ be a set consisted of representatives of conjuate classes of $G$.
Can we prove
$$\sum_{g\in G}\operatorname{tr}(\pi(g))=\sum_{\gamma \in S} \frac{|G|}{|G_\gamma|}\operatorname{tr}(\pi(\gamma))?$$
Thanks very much!
 A: *

*I'm assuming that $|G|$ is invertible in your field. Define $\psi : V \to V$ by averaging $\pi$ across $G$ (this is a common trick):
$$
 \psi(v) = \frac{1}{|G|}\sum_{g \in G} (\pi(g)(v)).
$$
Then
$$
\pi(h)\psi(v) = \frac{1}{|G|}\sum_{g \in G} (\rho(h)\pi(g)(v)) = \frac{1}{|G|}\sum_{g \in G} (\pi(hg)(v)) = \frac{1}{|G|}\sum_{g' \in G} (\pi(g')(v)) = \psi(v),
$$
for any $h \in G$ and $v \in V$, and so $\psi(V) \subseteq V^G$. But if $v \in V^G$, then
$$
\psi(v) = \frac{1}{|G|}\sum_{g \in G} (\pi(g)(v)) = \frac{1}{|G|}\sum_{g \in G} v = \frac{|G|}{|G|}v = v,
$$
and so $V^G \subseteq \psi(V)$. Here we have shown that $\psi$ is an involution with image $V^G$, or in other words it is a projection onto $V^G$. If we let $\cal{U}$ be a basis for $V^G$ and extend it to a basis $\cal{V} = \cal{U} \sqcup \cal{U}'$ for $V$, then the matrix of $\psi$ with respect to $\cal{V}$ has the block form
$$
\begin{pmatrix} I_{n\times n} & 0_{n \times m-n} \\ 0_{m-n \times n}  & 0_{m-n \times n-m}\end{pmatrix},
$$
where $n = \dim V^G$ and $m = \dim V$. Hence

$$
\dim V^G = \operatorname{trace}(\psi) = \frac{1}{|G|}\sum_{g \in G} \operatorname{trace}(\pi(g)),
$$
and multiplying by $|G|$ gives your result.


*This is because a character (trace of a representation) is constant on conjugacy classes. Indeed, since
$$\operatorname{trace}(ABC) = \operatorname{trace}(BCA) = \operatorname{trace}(CAB),$$
for all square matrices $A$, $B$, and $C$ of the same size, it follows that
$$
\operatorname{trace}(\pi(h^{-1}gh)) = \operatorname{trace}(\pi(h)^{-1}\pi(g)\pi(h)) = \operatorname{trace}(\pi(g)\pi(h)\pi(h)^{-1}) = \operatorname{trace}(\pi(g)\pi(hh^{-1})) = \operatorname{trace}(\pi(g)),
$$
for any $g,h \in G$. But then if $\{C_{\gamma} | \gamma \in S\}$ is your set of conjugacy classes, we have $\operatorname{trace}(\pi(g)) = \operatorname{trace}(\pi(\gamma))$ for all $g \in C_\gamma$, and so

$$
\sum_{g \in G} \operatorname{trace}(\pi(g)) = \sum_{\gamma \in S}\sum_{g \in C_\gamma} \operatorname{trace}(\pi(g)) = \sum_{\gamma \in S}\sum_{g \in C_\gamma} \operatorname{trace}(\pi(\gamma)) = \sum_{\gamma \in S} |C_\gamma|\operatorname{trace}(\pi(\gamma)).
$$
But by the orbit-stabiliser theorem, $|C_\gamma||G_\gamma| = |G|$ for each $\gamma \in S$, and so
$$
\sum_{g \in G} \operatorname{trace}(\pi(g)) = \sum_{\gamma \in S} \frac{|G|}{|G_\gamma|}\operatorname{trace}(\pi(\gamma)).
$$
(Note: I think you made a slight typo in your question, which has been resolved by this answer.)
A: $\newcommand{\tr}{\operatorname{tr}}$
This answer may be at risk of repeating what has already been said, but I think it should be useful.
As in your question, let $\nu = \sum_{g\in G} g$ be the 'norm element' of your group, which lives in the ring $kG$. Note that we may compute that
$$\nu^2 = \sum_{g,h\in G} gh =  \sum_{g,g^{-1}h\in G} gg^{-1}h= \sum_{g\in G} 1\sum_{h\in G} h=|G| \nu.$$
This means that

The element $\nu$ is a root of the polynomial $X^2 - |G|X$.

It follows that $\nu$ has eigenvalues equal to $0$ or $|G|$ and, in case $|G|$ is not zero in the base field $k$, that

The action of $\nu$ on $V$ is diagonalizable.

Hence $\tr(\nu) = n|G|$ where $n$ is the dimension of the image of
$\nu$ in $V$.
It is clear from its definition that $\nu$ lands in $V^G$, so it sufffices to show that there is equality. This is clear, since if $v$ is fixed by $g$ then we have that $\nu w = v$ where $w = |G|^{-1}v$. This gives that

For any base field $k$, we have that $\tr(\nu) = \dim(V^G)|G|$.

Indeed, this is true if $|G|=0$ in $k$, for then $\nu^2=0$ must have zero trace.
A: Just to add to Adam Higgins's point a matrix $A$ with $A^2=A$ is called idempotent (involutive is $A^2=I$). Of course as Pedro Tamaroff says it is diagonalizable with eigenvalues 1 or 0.  This follows from the Jordan Canonical form although it is an easy case.
