[proofplan]
We first construct local smooth oriented orthonormal frames by applying the [Gram-Schmidt process](/theorems/435) to local positively oriented frames. Such a frame identifies every oriented [orthonormal basis](/page/Orthonormal%20Basis) in the same fibre with a unique matrix in $SO(r)$, giving local trivializations of $\operatorname{Fr}_{SO}(E,h)$. The transition functions between these trivializations are smooth maps into $SO(r)$, so they define a smooth fibre bundle with fibre $SO(r)$. Finally, the usual right change-of-frame action restricts to a smooth, free, fibrewise transitive action of $SO(r)$.
[/proofplan]
[step:Handle the rank zero case separately]
If $r=0$, then each fibre $E_x$ is the zero [vector space](/page/Vector%20Space) and has the unique empty ordered orthonormal basis, which is positively oriented by the given orientation. Thus $\operatorname{Fr}_{SO}(E,h)$ is canonically identified with $M$, the projection $\pi_{SO}:\operatorname{Fr}_{SO}(E,h)\to M$ is the identity map, and $SO(0)$ is the one-element Lie group acting by the unique right action. This action is smooth, free, and transitive on each singleton fibre, so $\operatorname{Fr}_{SO}(E,h)\to M$ is a principal $SO(0)$-bundle. Assume from now on that $r\geq 1$.
[/step]
[step:Construct local oriented orthonormal frames]
Let $x_0 \in M$. Since $E$ is a smooth vector bundle of rank $r$, there is an open neighbourhood $U \subset M$ of $x_0$ and a smooth local frame
\begin{align*}
e=(e_1,\dots,e_r)
\end{align*}
where each $e_i:U \to E$ is a smooth section and $(e_1(x),\dots,e_r(x))$ is a basis of $E_x$ for every $x \in U$. Choose a coordinate chart around $x_0$ contained in the original trivializing neighbourhood, and replace $U$ by a connected coordinate ball inside that chart containing $x_0$. The orientation sign of the local frame is locally constant, hence constant on this connected neighbourhood. If the frame is negatively oriented, replace $e_1$ by $-e_1$; after this adjustment, $e=(e_1,\dots,e_r)$ is positively oriented on all of $U$.
Define smooth sections $v_i:U \to E$ recursively by Gram-Schmidt. Set
\begin{align*}
w_1 := e_1, \quad v_1 := h(w_1,w_1)^{-1/2}w_1.
\end{align*}
For $2 \le k \le r$, define
\begin{align*}
w_k := e_k - \sum_{i=1}^{k-1} h(e_k,v_i)v_i, \quad v_k := h(w_k,w_k)^{-1/2}w_k.
\end{align*}
Here $h(a,b):U \to \mathbb{R}$ denotes the smooth function $x \mapsto h_x(a(x),b(x))$ for smooth sections $a,b:U \to E$. We prove by induction on $k$ that $\operatorname{span}(v_1(x),\dots,v_k(x))=\operatorname{span}(e_1(x),\dots,e_k(x))$ for every $x \in U$. The case $k=1$ follows because $v_1$ is a positive scalar multiple of $e_1$. If the equality holds for $k-1$, then $w_k(x)$ differs from $e_k(x)$ by an element of $\operatorname{span}(e_1(x),\dots,e_{k-1}(x))$, so $w_k(x)$ cannot vanish because $(e_1(x),\dots,e_r(x))$ is a basis of $E_x$. Hence $v_k(x)$ is a positive scalar multiple of $w_k(x)$, and the span equality follows for $k$. Therefore each $w_k(x)$ is nonzero, so $h(w_k,w_k)$ is a positive smooth function and the square root is smooth. Thus each $v_k$ is a smooth section.
For every $x \in U$, the ordered basis $(v_1(x),\dots,v_r(x))$ is $h_x$-orthonormal. Moreover, the change-of-basis matrix from $(e_1(x),\dots,e_r(x))$ to $(v_1(x),\dots,v_r(x))$ is upper triangular with positive diagonal entries, because each $v_k(x)$ is obtained from $e_k(x)$ by subtracting a linear combination of earlier vectors and then multiplying by the positive scalar $h_x(w_k(x),w_k(x))^{-1/2}$. Hence its determinant is positive, so the frame
\begin{align*}
v=(v_1,\dots,v_r)
\end{align*}
is positively oriented.
[guided]
The goal of this step is to show that the object we want to trivialize has enough local sections: around every point of $M$, there is a smooth choice of positively oriented orthonormal basis in each fibre.
Fix $x_0 \in M$. Since $E$ is a smooth rank-$r$ vector bundle, there is an open neighbourhood $U \subset M$ of $x_0$ and smooth sections $e_i:U \to E$ such that
\begin{align*}
e=(e_1,\dots,e_r)
\end{align*}
is a basis of $E_x$ for every $x \in U$. Because $E$ is oriented, local frames are classified as positively or negatively oriented. To make one choice of sign valid on the whole neighbourhood, choose a coordinate chart around $x_0$ contained in the original trivializing neighbourhood, and replace $U$ by a connected coordinate ball inside that chart containing $x_0$. The orientation sign is locally constant, so on this connected set it is constant. If necessary, replacing $e_1$ by $-e_1$ makes the frame positively oriented on all of $U$.
Now we orthonormalize the frame without changing its orientation. Define smooth sections recursively. First set
\begin{align*}
w_1 := e_1, \quad v_1 := h(w_1,w_1)^{-1/2}w_1.
\end{align*}
For each integer $k$ with $2 \le k \le r$, define
\begin{align*}
w_k := e_k - \sum_{i=1}^{k-1} h(e_k,v_i)v_i, \quad v_k := h(w_k,w_k)^{-1/2}w_k.
\end{align*}
The notation $h(a,b)$ denotes the smooth real-valued function on $U$ given by $x \mapsto h_x(a(x),b(x))$ whenever $a,b:U \to E$ are smooth sections. We also need the standard span invariant in the Gram-Schmidt construction. We prove by induction on $k$ that $\operatorname{span}(v_1(x),\dots,v_k(x))=\operatorname{span}(e_1(x),\dots,e_k(x))$ for every $x \in U$. For $k=1$, the section $v_1$ is a positive scalar multiple of $e_1$. Assume the equality is known for $k-1$. Then $w_k(x)$ is obtained from $e_k(x)$ by subtracting a vector in $\operatorname{span}(v_1(x),\dots,v_{k-1}(x))=\operatorname{span}(e_1(x),\dots,e_{k-1}(x))$. If $w_k(x)=0$, then $e_k(x)$ would lie in $\operatorname{span}(e_1(x),\dots,e_{k-1}(x))$, contradicting that $(e_1(x),\dots,e_r(x))$ is a basis of $E_x$. Thus $w_k(x)$ never vanishes. Since $v_k(x)$ is a positive scalar multiple of $w_k(x)$, the span equality also holds at level $k$. Therefore $h(w_k,w_k)$ is a positive smooth function on $U$, and division by its positive square root is smooth.
The recursive construction gives $h_x(v_i(x),v_j(x))=\delta_{ij}$ for every $x \in U$ and all $1 \le i,j \le r$, so $(v_1(x),\dots,v_r(x))$ is $h_x$-orthonormal. It remains to check orientation. Each $v_k$ has the form
\begin{align*}
v_k = a_k e_k + \sum_{i=1}^{k-1} a_{ik} e_i
\end{align*}
for smooth real-valued functions $a_k,a_{ik}:U \to \mathbb{R}$ with $a_k=h(w_k,w_k)^{-1/2}>0$. Thus the change-of-basis matrix from $e$ to $v$ is upper triangular with positive diagonal entries. Its determinant is positive, so it preserves the given orientation. Hence $v=(v_1,\dots,v_r)$ is a smooth positively oriented orthonormal local frame.
[/guided]
[/step]
[step:Use a local oriented orthonormal frame to trivialize the bundle]
Let $v=(v_1,\dots,v_r)$ be a smooth positively oriented $h$-orthonormal frame over an [open set](/page/Open%20Set) $U \subset M$. For each $x \in U$ and each positively oriented $h_x$-orthonormal basis $u=(u_1,\dots,u_r)$ of $E_x$, there is a unique matrix $A=(A_{ij}) \in SO(r)$ such that
\begin{align*}
u_j = \sum_{i=1}^{r} v_i(x)A_{ij} \quad \text{for every } 1 \le j \le r.
\end{align*}
The matrix is orthogonal because both $u$ and $v(x)$ are $h_x$-orthonormal, and it has determinant $1$ because both bases are positively oriented.
Define $\Theta_v:\pi_{SO}^{-1}(U) \to U \times SO(r)$ by $\Theta_v(x,u)=(x,A)$, where $A$ is the unique matrix above. Define $\Psi_v:U \times SO(r) \to \pi_{SO}^{-1}(U)$ by
\begin{align*}
\Psi_v(x,A)=\left(x,\left(\sum_{i=1}^{r}v_i(x)A_{i1},\dots,\sum_{i=1}^{r}v_i(x)A_{ir}\right)\right).
\end{align*}
Thus $\Theta_v$ is a bijection over $U$.
[guided]
This step turns one smooth positively oriented orthonormal local frame into an actual local product chart. Let $v=(v_1,\dots,v_r)$ be a smooth positively oriented $h$-orthonormal frame over an open set $U \subset M$. For each $x \in U$, the ordered tuple $v(x)=(v_1(x),\dots,v_r(x))$ is a positively oriented $h_x$-orthonormal basis of $E_x$.
Take an element $(x,u)\in \pi_{SO}^{-1}(U)$, where $u=(u_1,\dots,u_r)$ is a positively oriented $h_x$-orthonormal basis of $E_x$. Since $v(x)$ is a basis of $E_x$, there is a unique real matrix $A=(A_{ij})\in \mathbb{R}^{r\times r}$ satisfying
\begin{align*}
u_j = \sum_{i=1}^{r} v_i(x)A_{ij} \quad \text{for every } 1 \le j \le r.
\end{align*}
The matrix $A$ is orthogonal because the Gram matrix of $u$ and the Gram matrix of $v(x)$ with respect to $h_x$ are both the identity matrix. The determinant of $A$ is positive because $u$ and $v(x)$ determine the same orientation of $E_x$. Since an orthogonal matrix has determinant $1$ or $-1$, this gives $\det A=1$, so $A\in SO(r)$.
Define
\begin{align*}
\Theta_v:\pi_{SO}^{-1}(U) \to U \times SO(r)
\end{align*}
by $\Theta_v(x,u)=(x,A)$, where $A$ is the unique matrix above. Define the inverse candidate
\begin{align*}
\Psi_v:U \times SO(r) \to \pi_{SO}^{-1}(U)
\end{align*}
by
\begin{align*}
\Psi_v(x,A)=\left(x,\left(\sum_{i=1}^{r}v_i(x)A_{i1},\dots,\sum_{i=1}^{r}v_i(x)A_{ir}\right)\right).
\end{align*}
For $A\in SO(r)$, the displayed ordered basis is $h_x$-orthonormal because $A$ is orthogonal, and it is positively oriented because $\det A=1$. Thus $\Psi_v$ really lands in $\pi_{SO}^{-1}(U)$. The uniqueness of coordinate matrices relative to the basis $v(x)$ gives $\Theta_v\circ\Psi_v=\operatorname{id}_{U\times SO(r)}$ and $\Psi_v\circ\Theta_v=\operatorname{id}_{\pi_{SO}^{-1}(U)}$. Hence $\Theta_v$ is a fibre-preserving bijection over $U$.
[/guided]
[/step]
[step:Check that the transition functions are smooth and $SO(r)$-valued]
Let $v=(v_1,\dots,v_r)$ and $\tilde v=(\tilde v_1,\dots,\tilde v_r)$ be smooth positively oriented $h$-orthonormal frames over open sets $U,V \subset M$. On $U \cap V$, define
\begin{align*}
B:U \cap V \to SO(r)
\end{align*}
by the relation
\begin{align*}
\tilde v_j(x)=\sum_{i=1}^{r}v_i(x)B_{ij}(x) \quad \text{for every } x \in U \cap V \text{ and } 1 \le j \le r.
\end{align*}
The entries are given by
\begin{align*}
B_{ij}(x)=h_x(v_i(x),\tilde v_j(x)),
\end{align*}
so $B$ is smooth. Since both frames are oriented and orthonormal, $B(x) \in SO(r)$ for every $x \in U \cap V$.
If $\Theta_v(x,u)=(x,A)$ and $\Theta_{\tilde v}(x,u)=(x,C)$, then
\begin{align*}
u_j=\sum_{i=1}^{r}v_i(x)A_{ij}=\sum_{k=1}^{r}\tilde v_k(x)C_{kj}.
\end{align*}
Using $\tilde v=vB$, this gives $A=B(x)C$, hence
\begin{align*}
C=B(x)^{-1}A.
\end{align*}
Therefore the transition map $\Theta_{\tilde v}\circ \Theta_v^{-1}: (U \cap V)\times SO(r) \to (U \cap V)\times SO(r)$ is
\begin{align*}
(\Theta_{\tilde v}\circ \Theta_v^{-1})(x,A)=(x,B(x)^{-1}A).
\end{align*}
This map is smooth because $B$ is smooth and multiplication and inversion in the Lie group $SO(r)$ are smooth. Since every local positively oriented orthonormal frame produces a chart of this form and the transition map between any two such charts is the smooth map just computed, these charts form a compatible smooth atlas. Refining or replacing the chosen local frames only adds charts with the same smooth transition formula. Equivalently, the constructed maximal smooth structure is uniquely determined by the requirement that every local trivialization arising from a smooth positively oriented orthonormal frame be smooth. The local trivializations therefore define a smooth fibre bundle structure on $\pi_{SO}:\operatorname{Fr}_{SO}(E,h)\to M$ with fibre $SO(r)$.
[guided]
This step checks that the local charts built from different oriented orthonormal frames are compatible. Let $v=(v_1,\dots,v_r)$ and $\tilde v=(\tilde v_1,\dots,\tilde v_r)$ be smooth positively oriented $h$-orthonormal frames over open sets $U,V\subset M$. On $U\cap V$, define the change-of-frame map
\begin{align*}
B:U\cap V\to SO(r)
\end{align*}
by requiring
\begin{align*}
\tilde v_j(x)=\sum_{i=1}^{r}v_i(x)B_{ij}(x) \quad \text{for every } x\in U\cap V \text{ and } 1\le j\le r.
\end{align*}
The entries are
\begin{align*}
B_{ij}(x)=h_x(v_i(x),\tilde v_j(x)),
\end{align*}
so each $B_{ij}$ is smooth because $h$, $v_i$, and $\tilde v_j$ are smooth. For each $x$, the matrix $B(x)$ is orthogonal because both frames are $h_x$-orthonormal, and $\det B(x)=1$ because both frames are positively oriented. Hence $B$ is a smooth map into $SO(r)$.
Now compare the two coordinate descriptions of the same frame $u$. Suppose $\Theta_v(x,u)=(x,A)$ and $\Theta_{\tilde v}(x,u)=(x,C)$. Then
\begin{align*}
u_j=\sum_{i=1}^{r}v_i(x)A_{ij}=\sum_{k=1}^{r}\tilde v_k(x)C_{kj}.
\end{align*}
Substituting $\tilde v_k(x)=\sum_{i=1}^{r}v_i(x)B_{ik}(x)$ into the second expression and using uniqueness of coordinates relative to the basis $v(x)$ gives $A=B(x)C$. Therefore $C=B(x)^{-1}A$, and the transition map is
\begin{align*}
(\Theta_{\tilde v}\circ \Theta_v^{-1})(x,A)=(x,B(x)^{-1}A).
\end{align*}
The map is smooth because $B$ is smooth and inversion and multiplication in the Lie group $SO(r)$ are smooth. Thus the local trivializations form a compatible smooth atlas, and they define a smooth fibre bundle structure on $\pi_{SO}:\operatorname{Fr}_{SO}(E,h)\to M$ with fibre $SO(r)$.
[/guided]
[/step]
[step:Define the right $SO(r)$ action and prove it is principal]
Define a right action
\begin{align*}
\rho:\operatorname{Fr}_{SO}(E,h)\times SO(r)\to \operatorname{Fr}_{SO}(E,h)
\end{align*}
by
\begin{align*}
\rho((x,u),Q)=\left(x,\left(\sum_{j=1}^{r}u_jQ_{j1},\dots,\sum_{j=1}^{r}u_jQ_{jr}\right)\right).
\end{align*}
For fixed $(x,u)$ and $Q \in SO(r)$, the new ordered basis is $h_x$-orthonormal because $Q$ is orthogonal, and it is positively oriented because $\det Q=1$. Thus $\rho$ is well-defined. Let $I_r\in SO(r)$ denote the $r\times r$ identity matrix. The identity axiom follows because right multiplication by $I_r$ leaves every ordered frame unchanged. If $Q,R \in SO(r)$, then applying first $Q$ and then $R$ gives coordinate matrix $QR$ relative to $u$, so $\rho(\rho((x,u),Q),R)=\rho((x,u),QR)$ by associativity of matrix multiplication. Hence $\rho$ is a right [group action](/page/Group%20Action).
In the local trivialization determined by $v$, if $\Theta_v(x,u)=(x,A)$, then
\begin{align*}
\Theta_v(\rho((x,u),Q))=(x,AQ).
\end{align*}
Hence the action is smooth. It is fibre-preserving because the base point $x$ is unchanged.
The action is free: if $\rho((x,u),Q)=(x,u)$, then the coordinate matrix of the resulting basis relative to $u$ is $Q$, while the coordinate matrix of $u$ relative to itself is $I_r$, so $Q=I_r$. The action is transitive on each fibre: if $(x,u)$ and $(x,w)$ are two elements of $\pi_{SO}^{-1}(x)$, then there is a unique $Q \in SO(r)$ such that
\begin{align*}
w_j=\sum_{i=1}^{r}u_iQ_{ij} \quad \text{for every } 1 \le j \le r.
\end{align*}
This $Q$ is orthogonal because $u$ and $w$ are $h_x$-orthonormal, and $\det Q=1$ because both bases are positively oriented. Therefore $w=\rho((x,u),Q)$.
Thus $\pi_{SO}:\operatorname{Fr}_{SO}(E,h)\to M$ is a smooth principal $SO(r)$-bundle.
[guided]
We now verify the defining principal-bundle action, rather than only the local triviality.
Define
\begin{align*}
\rho:\operatorname{Fr}_{SO}(E,h)\times SO(r)\to \operatorname{Fr}_{SO}(E,h)
\end{align*}
by changing the frame on the right:
\begin{align*}
\rho((x,u),Q)=\left(x,\left(\sum_{j=1}^{r}u_jQ_{j1},\dots,\sum_{j=1}^{r}u_jQ_{jr}\right)\right).
\end{align*}
Here $u=(u_1,\dots,u_r)$ is a positively oriented $h_x$-orthonormal basis of $E_x$, and $Q=(Q_{ij})$ is a matrix in $SO(r)$. Orthogonality of $Q$ implies that the new basis is still $h_x$-orthonormal: changing coordinates by an orthogonal matrix preserves the Euclidean [inner product](/page/Inner%20Product) matrix of the basis. The determinant condition $\det Q=1$ implies that the orientation is also preserved. Hence $\rho$ is well-defined as a map into $\operatorname{Fr}_{SO}(E,h)$. We also verify the action axioms. Let $I_r\in SO(r)$ denote the $r\times r$ identity matrix. Acting by $I_r$ gives
\begin{align*}
\rho((x,u),I_r)=(x,u),
\end{align*}
because the columns of $I_r$ select the original vectors $u_1,\dots,u_r$. If $Q,R \in SO(r)$, then applying $Q$ and then $R$ forms the frame whose $j$th vector is
\begin{align*}
\sum_{k=1}^{r}\left(\sum_{i=1}^{r}u_iQ_{ik}\right)R_{kj}=\sum_{i=1}^{r}u_i(QR)_{ij}.
\end{align*}
Thus $\rho(\rho((x,u),Q),R)=\rho((x,u),QR)$, where the equality uses the definition of matrix multiplication. Therefore $\rho$ is a right group action.
To check smoothness, use one of the local trivializations already constructed. Let $v=(v_1,\dots,v_r)$ be a local positively oriented orthonormal frame over $U$, and suppose
\begin{align*}
\Theta_v(x,u)=(x,A).
\end{align*}
This means that
\begin{align*}
u_j=\sum_{i=1}^{r}v_i(x)A_{ij}.
\end{align*}
After acting by $Q$, the new frame has $j$th vector
\begin{align*}
\sum_{k=1}^{r}u_kQ_{kj}=\sum_{k=1}^{r}\sum_{i=1}^{r}v_i(x)A_{ik}Q_{kj}=\sum_{i=1}^{r}v_i(x)(AQ)_{ij}.
\end{align*}
Therefore, in the chart $\Theta_v$, the action is exactly
\begin{align*}
(x,A,Q)\mapsto (x,AQ).
\end{align*}
Matrix multiplication in $SO(r)$ is smooth, so the action is smooth. The action is fibre-preserving because the point $x \in M$ is unchanged.
Finally, we verify the two algebraic conditions for a principal action. If $\rho((x,u),Q)=(x,u)$, then the right multiplication by $Q$ leaves the ordered basis $u$ unchanged. Since an ordered basis has unique coordinate expressions, the coordinate matrix must be the identity matrix $I_r$, so $Q=I_r$. Thus the action is free.
For transitivity on the fibre over $x$, take two positively oriented $h_x$-orthonormal bases $u=(u_1,\dots,u_r)$ and $w=(w_1,\dots,w_r)$ of $E_x$. Since $u$ is a basis, there is a unique real matrix $Q=(Q_{ij})$ satisfying
\begin{align*}
w_j=\sum_{i=1}^{r}u_iQ_{ij} \quad \text{for every } 1 \le j \le r.
\end{align*}
Because both bases are $h_x$-orthonormal, this coordinate matrix is orthogonal. Because both bases are positively oriented, its determinant is positive; for an orthogonal matrix the determinant is either $1$ or $-1$, so $\det Q=1$. Hence $Q \in SO(r)$, and $w=\rho((x,u),Q)$. This proves fibrewise transitivity.
The projection $\pi_{SO}$ is therefore locally trivial with fibre $SO(r)$, and the smooth right $SO(r)$ action is free and transitive on each fibre. Hence $\operatorname{Fr}_{SO}(E,h)\to M$ is a principal $SO(r)$-bundle.
[/guided]
[/step]