[proofplan]
We express both sides of the Lefschetz formula in terms of the diagonal class. The left side (signed count of fixed points) equals the intersection number $[\Gamma_f] \cdot [\Delta(M)]$, which by Poincaré duality equals $(\delta_{\Gamma_f} \smile \delta_{\Delta})[M \times M]$ where $\delta_{\Gamma_f}$ and $\delta_{\Delta}$ are the Poincaré duals of the graph and diagonal. The right side (alternating trace) equals $\Delta^*(F^*\delta)[M]$ where $F = (\operatorname{id}, f): M \to M \times M$. We show these are equal by identifying $\delta_{\Gamma_f}$ with the class obtained by pushing forward via $F$, and then reducing the computation to the trace formula using the Künneth decomposition of $\delta$.
[/proofplan]
[step:Express the signed fixed-point count as an intersection number]
The fixed points of $f$ are the points $x \in M$ where the graph $\Gamma_f = \{(x, f(x)) : x \in M\}$ meets the diagonal $\Delta(M) = \{(x, x) : x \in M\}$. Since the intersection is transverse by hypothesis, each fixed point $x$ contributes $\pm 1$ to the intersection number according to whether the intersection is positively or negatively oriented. The sign at a fixed point $x$ is $\operatorname{sgn} \det(I - D_x f)$: this is because the tangent space $T_{(x,x)}(M \times M) \cong T_x M \oplus T_x M$, the tangent space of $\Delta(M)$ at $(x, x)$ is $\{(v, v) : v \in T_x M\}$, and the tangent space of $\Gamma_f$ at $(x, f(x)) = (x, x)$ is $\{(v, D_x f(v)) : v \in T_x M\}$. The direct sum of these two subspaces spans $T_x M \oplus T_x M$ iff $I - D_x f$ is invertible, and the orientation of the sum relative to the product orientation is $\operatorname{sgn} \det(I - D_x f)$. Therefore
\begin{align*}
\sum_{x \in \mathrm{Fix}(f)} \operatorname{sgn} \det(I - D_x f) = [\Gamma_f] \cdot [\Delta(M)],
\end{align*}
where $[\Gamma_f] \cdot [\Delta(M)]$ denotes the intersection number in $M \times M$.
[guided]
Why is the sign $\operatorname{sgn} \det(I - D_x f)$? At a fixed point $x$, both $\Gamma_f$ and $\Delta(M)$ pass through $(x, x) \in M \times M$. The tangent space of $M \times M$ at $(x, x)$ is $T_x M \oplus T_x M$. The tangent space of the diagonal is the "diagonal copy" $\{(v, v)\}$, and the tangent space of the graph is $\{(v, D_xf(v))\}$. To compute the intersection sign, we need to express a positively oriented basis of $T_x M \oplus T_x M$ in terms of bases of these two subspaces.
Choose a positively oriented basis $e_1, \ldots, e_d$ of $T_x M$. The diagonal contributes $(e_1, e_1), \ldots, (e_d, e_d)$, and the graph contributes $(e_1, D_xf(e_1)), \ldots, (e_d, D_xf(e_d))$. The change-of-basis matrix from the product basis $\{(e_i, 0), (0, e_j)\}$ to the union of these two bases has determinant $\det(I - D_xf)$ (after a column reduction). The sign of this determinant determines whether the orientation agrees with the product orientation.
[/guided]
[/step]
[step:Translate the intersection number to Poincaré duals via the cup product]
By [Poincaré Duality](/theorems/2291) on $M \times M$ (which is a compact $2d$-dimensional oriented manifold), the intersection number of two complementary-dimensional submanifolds equals the cup product of their Poincaré duals evaluated on the fundamental class. Specifically:
\begin{align*}
[\Gamma_f] \cdot [\Delta(M)] = \bigl(D_{M \times M}^{-1}[\Gamma_f] \smile D_{M \times M}^{-1}[\Delta(M)]\bigr)[M \times M].
\end{align*}
The Poincaré dual of the diagonal is the diagonal class: $D_{M \times M}^{-1}[\Delta(M)] = \delta$.
[/step]
[step:Identify the Poincaré dual of the graph with the pullback of $\delta$]
Define $F: M \to M \times M$ by $F(x) = (x, f(x))$. Then $\Gamma_f = F(M)$. Since $F$ is an embedding (as a section of $\pi_1: M \times M \to M$), the [Poincaré Dual of a Submanifold](/theorems/2295) gives $D_{M \times M}^{-1}[\Gamma_f]$ as the extension by zero of the Thom class of the normal bundle of $\Gamma_f$ in $M \times M$.
For any cohomology class $\omega \in H^d(M \times M; \mathbb{Q})$, the defining property of the Poincaré dual gives
\begin{align*}
(\omega \smile D_{M \times M}^{-1}[\Gamma_f])[M \times M] = \omega[\Gamma_f] = (F^*\omega)[M].
\end{align*}
Applying this with $\omega = \delta$:
\begin{align*}
(\delta \smile D_{M \times M}^{-1}[\Gamma_f])[M \times M] = (F^*\delta)[M].
\end{align*}
By commutativity of the cup product (with the appropriate sign, but both classes are in degree $d$, so the sign is $(-1)^{d \cdot d} = (-1)^{d^2}$, and applying the same identity from the other side gives the same sign), we also have
\begin{align*}
(D_{M \times M}^{-1}[\Gamma_f] \smile \delta)[M \times M] = (F^*\delta)[M].
\end{align*}
Therefore the intersection number equals
\begin{align*}
[\Gamma_f] \cdot [\Delta(M)] = (F^*\delta)[M].
\end{align*}
[/step]
[step:Compute $F^*\delta$ using the Künneth decomposition]
By the [Diagonal Class](/theorems/2296) formula, $\delta = \sum_i (-1)^{|a_i|} a_i \otimes b_i$ where $\{a_i\}$ is a basis for $H^*(M; \mathbb{Q})$ and $\{b_i\}$ is the dual basis. Since $F = (\operatorname{id}_M, f)$, we have $F^* = \operatorname{id}^* \otimes f^*$ on Künneth components. Specifically, for $\alpha \otimes \beta = \pi_1^*\alpha \smile \pi_2^*\beta$:
\begin{align*}
F^*(\alpha \otimes \beta) = (\pi_1 \circ F)^*\alpha \smile (\pi_2 \circ F)^*\beta = \alpha \smile f^*\beta,
\end{align*}
since $\pi_1 \circ F = \operatorname{id}_M$ and $\pi_2 \circ F = f$. Applying this to $\delta$:
\begin{align*}
F^*\delta = \sum_i (-1)^{|a_i|} a_i \smile f^*b_i.
\end{align*}
[/step]
[step:Evaluate on $[M]$ to obtain the alternating trace]
Evaluating on $[M]$:
\begin{align*}
(F^*\delta)[M] = \sum_i (-1)^{|a_i|} (a_i \smile f^*b_i)[M].
\end{align*}
Since $f^*b_i \in H^{d - |a_i|}(M; \mathbb{Q})$ (because $|b_i| = d - |a_i|$), the cup product $a_i \smile f^*b_i$ lies in $H^d(M; \mathbb{Q})$ and can be evaluated on $[M]$. We express $f^*b_i$ in the basis: since $\{a_j\}_{|a_j| = d - |a_i|}$ and $\{b_j\}_{|b_j| = d - |a_i|}$ are dual bases for $H^{d-|a_i|}(M; \mathbb{Q})$, we can write $f^*b_i = \sum_{j: |a_j| = |a_i|} (a_j \smile f^*b_i)[M] \cdot b_j$. Then
\begin{align*}
(a_i \smile f^*b_i)[M] = \langle a_i, f^*b_i \rangle.
\end{align*}
Now consider the matrix of $f^*: H^k(M; \mathbb{Q}) \to H^k(M; \mathbb{Q})$ in the basis $\{b_j\}_{|b_j| = d-k}$ (equivalently, $\{a_j\}_{|a_j| = k}$). The $(i, j)$ entry of $f^*$ in the $\{a_j\}$ basis for degree $k = |a_i|$ is $(a_j \smile f^*b_i)[M]$ where $j$ ranges over indices with $|a_j| = |a_i|$. In particular, the diagonal entry (where $j = i$) is $(a_i \smile f^*b_i)[M]$.
Summing over all basis elements $a_i$ of degree $k$:
\begin{align*}
\sum_{i: |a_i| = k} (a_i \smile f^*b_i)[M] = \operatorname{tr}\bigl(f^*: H^k(M; \mathbb{Q}) \to H^k(M; \mathbb{Q})\bigr).
\end{align*}
Therefore
\begin{align*}
(F^*\delta)[M] = \sum_{k=0}^d (-1)^k \operatorname{tr}\bigl(f^*: H^k(M; \mathbb{Q}) \to H^k(M; \mathbb{Q})\bigr).
\end{align*}
[guided]
Let us unpack the trace computation. Fix a degree $k$ and let $a_1, \ldots, a_r$ be the basis elements with $|a_i| = k$, so $b_1, \ldots, b_r$ have degree $d - k$ and $\langle a_i, b_j \rangle = \delta_{ij}$. The map $f^*: H^{d-k}(M; \mathbb{Q}) \to H^{d-k}(M; \mathbb{Q})$ sends $b_i \mapsto f^*b_i = \sum_j M_{ji} b_j$ for some matrix $M_{ji}$. To find $M_{ji}$, pair with $a_j$:
\begin{align*}
\langle a_j, f^*b_i \rangle = (a_j \smile f^*b_i)[M] = M_{ji}.
\end{align*}
The diagonal entry is $M_{ii} = (a_i \smile f^*b_i)[M]$, and the trace is $\sum_i M_{ii}$.
But $f^*$ on $H^{d-k}$ in the $\{b_i\}$ basis has the same trace as $f^*$ on $H^k$ in the $\{a_i\}$ basis (since Poincaré duality intertwines the two, and the trace is basis-independent). Alternatively, one can directly verify that the matrix of $f^*$ on $H^k$ in the $\{a_i\}$ basis has entries $(f^*a_j \smile b_i)[M]$, and the relation $(a_j \smile f^*b_i)[M] = (f^*a_j \smile b_i)[M]$ follows from the naturality formula $\varphi(f_*\sigma) = (f^*\varphi)(\sigma)$. Either way, $\sum_i (a_i \smile f^*b_i)[M]$ is the trace of $f^*$ acting on degree $k$ cohomology.
Collecting all degrees with the signs $(-1)^k$ gives the Lefschetz number $\Lambda(f) = \sum_k (-1)^k \operatorname{tr}(f^*|_{H^k})$.
[/guided]
[/step]
[step:Combine to obtain the Lefschetz fixed point formula]
Assembling the chain of equalities:
\begin{align*}
\sum_{x \in \mathrm{Fix}(f)} \operatorname{sgn} \det(I - D_x f) &= [\Gamma_f] \cdot [\Delta(M)] \\
&= (D_{M \times M}^{-1}[\Gamma_f] \smile \delta)[M \times M] \\
&= (F^*\delta)[M] \\
&= \sum_{k=0}^d (-1)^k \operatorname{tr}\bigl(f^*: H^k(M; \mathbb{Q}) \to H^k(M; \mathbb{Q})\bigr).
\end{align*}
This completes the proof of the Lefschetz fixed point theorem.
[/step]