[proofplan]
The idempotence condition identifies the fixed-point space of $P(p)$ with the image of $P(p)$ in each fiber. Around an arbitrary point $p_0 \in M$, choose vectors whose $P(p_0)$-images form a basis of this image. A nonzero coordinate minor shows that these images remain linearly independent on a smaller neighbourhood, and the constant rank hypothesis then forces them to span every nearby image. These local smooth bases give local bundle charts for $E_P$, proving that it is a smooth rank $k$ subbundle of the trivial bundle.
[/proofplan]
custom_env
admin
[step:Identify each fiber with the image of the idempotent]
For each $p \in M$, define the [linear map](/page/Linear%20Map) $P_p: \mathbb{R}^n \to \mathbb{R}^n$ by
\begin{align*}
P_p(v):=P(p)v.
\end{align*}
Since $P(p)^2=P(p)$, we have
\begin{align*}
\{v \in \mathbb{R}^n : P_p v = v\} = \operatorname{im} P_p.
\end{align*}
Indeed, if $P_p v=v$, then $v=P_p v \in \operatorname{im} P_p$. Conversely, if $v=P_p w$ for some $w \in \mathbb{R}^n$, then
\begin{align*}
P_p v = P_p(P_p w)=P_p^2 w=P_p w=v.
\end{align*}
Thus the fiber of $E_P$ over $p$ is precisely $\operatorname{im} P_p$, and therefore has dimension $k$ by hypothesis.
[/step]
custom_env
admin
[step:Choose local generators whose images remain independent]Fix $p_0 \in M$. If $k=0$, then $\operatorname{im}P_p=\{0\}$ for every $p \in M$, so $E_P=M \times \{0\}$ is the zero subbundle of $M \times \mathbb{R}^n$. Hence assume $k \ge 1$.
Since $\operatorname{rank}P_{p_0}=k$, choose vectors $v_1,\dots,v_k \in \mathbb{R}^n$ such that
\begin{align*}
P_{p_0}v_1,\dots,P_{p_0}v_k
\end{align*}
form a basis of $\operatorname{im}P_{p_0}$. Because these vectors are linearly independent in $\mathbb{R}^n$, there exist indices $1 \le j_1<\dots<j_k \le n$ such that the $k \times k$ matrix $A(p_0)$ with entries
\begin{align*}
A(p_0)_{ab}:=(P_{p_0}v_b)_{j_a}, \qquad 1 \le a,b \le k,
\end{align*}
has nonzero determinant.
Define the map $A: M \to M_k(\mathbb{R})$ by
\begin{align*}
A(p):=\big((P_pv_b)_{j_a}\big)_{1 \le a,b \le k}.
\end{align*}
The map $A$ is smooth because $P$ is smooth and $v_1,\dots,v_k$ are fixed vectors. Since $\det A(p_0)\ne 0$ and $\det A$ is continuous, there exists an open neighbourhood $U \subset M$ of $p_0$ such that $\det A(p)\ne 0$ for every $p \in U$. Hence
\begin{align*}
P_pv_1,\dots,P_pv_k
\end{align*}
are linearly independent for every $p \in U$.[/step]
custom_env
admin
[guided]Fix a point $p_0 \in M$. The goal is to build a local frame for $E_P$ near $p_0$, so we first choose candidate frame vectors in the fiber over $p_0$. If $k=0$, then the rank hypothesis gives $\operatorname{im}P_p=\{0\}$ for every $p \in M$, and the fiber computation from the previous step gives $E_P=M \times \{0\}$. This is the smooth rank $0$ subbundle of the trivial bundle. We therefore assume $k \ge 1$.
Because $\operatorname{rank}P_{p_0}=k$, the image $\operatorname{im}P_{p_0}$ is a $k$-dimensional subspace of $\mathbb{R}^n$. Choose vectors $v_1,\dots,v_k \in \mathbb{R}^n$ such that
\begin{align*}
P_{p_0}v_1,\dots,P_{p_0}v_k
\end{align*}
form a basis of $\operatorname{im}P_{p_0}$. We now need this basis to persist for nearby points. [Linear independence](/page/Linear%20Independence) in $\mathbb{R}^n$ can be detected by a nonzero coordinate minor: since these $k$ vectors are linearly independent, there are indices $1 \le j_1<\dots<j_k \le n$ for which the $k \times k$ coordinate matrix
\begin{align*}
A(p_0)_{ab}:=(P_{p_0}v_b)_{j_a}, \qquad 1 \le a,b \le k,
\end{align*}
has nonzero determinant.
Now define the matrix-valued map $A: M \to M_k(\mathbb{R})$ by
\begin{align*}
A(p):=\big((P_pv_b)_{j_a}\big)_{1 \le a,b \le k}.
\end{align*}
The vectors $v_b$ are fixed, and the entries of $P_pv_b$ depend smoothly on $p$ because $P:M\to M_n(\mathbb{R})$ is smooth. Therefore $A$ is smooth, and $\det A:M\to\mathbb{R}$ is continuous. Since $\det A(p_0)\ne 0$, there is an open neighbourhood $U \subset M$ of $p_0$ such that $\det A(p)\ne 0$ for every $p \in U$. For each such $p$, the nonzero determinant of this coordinate minor implies that
\begin{align*}
P_pv_1,\dots,P_pv_k
\end{align*}
are linearly independent in $\mathbb{R}^n$.[/guided]
custom_env
admin
[step:Show the local generators form a smooth frame for $E_P$]
For each $i \in \{1,\dots,k\}$, define the local section $s_i: U \to U \times \mathbb{R}^n$ by
\begin{align*}
s_i(p):=(p,P_pv_i).
\end{align*}
The section $s_i$ is smooth because $p \mapsto P_pv_i$ is smooth. Moreover $s_i(p) \in E_P$ for every $p \in U$, since
\begin{align*}
P_p(P_pv_i)=P_p^2v_i=P_pv_i.
\end{align*}
For each $p \in U$, the vectors $P_pv_1,\dots,P_pv_k$ are linearly independent and lie in $\operatorname{im}P_p$. Since $\dim \operatorname{im}P_p=k$, they form a basis of $\operatorname{im}P_p$. By the fiber identification above, they form a basis of the fiber $(E_P)_p$.
[/step]
custom_env
admin
[step:Construct local trivializations from the smooth frame]
Define the map $\Phi: U \times \mathbb{R}^k \to E_P \cap (U \times \mathbb{R}^n)$ by
\begin{align*}
\Phi(p,a):=\left(p,\sum_{i=1}^k a_i P_pv_i\right),
\end{align*}
where $a=(a_1,\dots,a_k) \in \mathbb{R}^k$. The map $\Phi$ is smooth because each coefficient map $p \mapsto P_pv_i$ is smooth and the expression is linear in $a$.
For each fixed $p \in U$, define the fiber map $\Phi_p: \mathbb{R}^k \to (E_P)_p$ by
\begin{align*}
\Phi_p(a):=\sum_{i=1}^k a_i P_pv_i.
\end{align*}
This map is a linear isomorphism because $P_pv_1,\dots,P_pv_k$ is a basis of $(E_P)_p$.
It remains to justify smoothness of the inverse coordinates. Let $\pi_J: \mathbb{R}^n \to \mathbb{R}^k$ be the coordinate projection
\begin{align*}
\pi_J(w):=(w_{j_1},\dots,w_{j_k}).
\end{align*}
For $w=\sum_{i=1}^k a_iP_pv_i \in (E_P)_p$, applying $\pi_J$ gives
\begin{align*}
\pi_J(w)=A(p)a.
\end{align*}
Since $\det A(p)\ne 0$ on $U$, the inverse matrix $A(p)^{-1}$ exists for every $p \in U$ and depends smoothly on $p$ by the adjugate formula for matrix inversion. Hence the inverse of $\Phi$ is the map $E_P \cap (U \times \mathbb{R}^n) \to U \times \mathbb{R}^k$ given by
\begin{align*}
(p,w)\mapsto \big(p,A(p)^{-1}\pi_J(w)\big),
\end{align*}
which is smooth as a composition of smooth maps. Therefore $\Phi$ is a smooth local vector bundle trivialization of $E_P$ over $U$.
Since $p_0 \in M$ was arbitrary, such a smooth rank $k$ local trivialization exists around every point of $M$. Therefore $E_P$ is a smooth rank $k$ vector subbundle of the trivial bundle $M \times \mathbb{R}^n \to M$.
[/step]