Let $A$ be a $2\times 2$ squared matrix. Prove that max $tr\ (A)$ s.t. $AA^{T}=I$ has solution. 
Let a squared matrix $A=\bigl(\begin{smallmatrix}
x_{11} & x_{12} \\ 
x_{21} & x_{22}
\end{smallmatrix}\bigr)$. Prove that the following optimization problem:
max $tr\ (A)$  s.t. $AA^{T}=I$
Where $tr$ is the trace of matrix A, $A^{T}$ is the transpose of matrix A and $I$ is the identity matrix.

My attempt
It follows the Berge's Maximum Theorem. But I have to prove two things:
a.) $tr(A)$ is a continuous function. That is $tr(A)=x_{11}+x_{22}$ is continuous.
b.) $AA^{T}=I$ is a compact set. That is, the following set is compact:
$\{\begin{matrix}
x_{11}^2+x_{12}^2=1
\\ x_{21}^2+x_{22}^2=1
\\ x_{11}.x_{21}+x_{12}.x_{22}=0
\end{matrix} $
But I don't know what else to do. Any suggestion?
 A: I might be missing something but the condition that $AA^T = I$ implies that $A$ is an orthogonal matrix. Thus, the columns (or rows) of $A$ form an orthonormal basis for $\mathbb{R}^2$ (I'm assuming this is over the reals). Thus $x_{ij} \leq 1$ for all $i,j$. 
Therefore, $tr(A) \leq 2$. Since $tr(I) = 2$ we have that the maximum is attained. 
A: One way is to note that $\|Ax\|_2^2 = \langle Ax, Ax \rangle = \langle x, A^TAx \rangle = \|x\|^2$, and so $\|A\|_2 =1$.
Alternatively, one could use the Frobenius norm to get $\|A\|_F^2 = \operatorname{tr} (A^T A) =  \operatorname{tr} I = n$. Hence
$\|A\|_F = \sqrt{n}$ and so the set $F=\{ A | g(A) = I \}$ is bounded.
Since the function $g(A) = A^T A -I$ is continuous, and $F$ is bounded, we see that $F$ is closed and bounded, hence compact.
The function $f(A) = \operatorname{tr}A$ is linear, hence continuous.
Hence $\max \{ f(A) | g(A) = 0 \}$ has a solution.
Since all eigenvalues of $A$ are bounded by $1$ (since $\|A\|_2 = 1$) we have
$f(A) \le n$, and since $I \in F$ and $f(I) = n$ we see that the $\max$ is $n$.
