A question about $SL(2,\mathbb{R})$ My professor gave me an exercise where I had to show that the special linear group $SL(2,\mathbb{R})$ is a lie subgroup of $GL(2,\mathbb{R})$. I was able to do this part. However, I was then asked to do the following:
All real $2\times 2$ matrices $\begin{pmatrix} a & b \\ c & d\end{pmatrix}$ can be identified with $(a,b,c,d) \in \mathbb{R}^4$. In this way, $SL(2,\mathbb{R})$ can be thought of as a subset of $\mathbb{R}^4$. In this correspondence, find all matrices in $SL(2,\mathbb{R})$ that are closest to the origin.
I really don't have any idea how to approach this problem. The only things I have ever seen like this are Lagrange multipliers, but those don't seem to apply here. For reference, though this exercise is not in the text, our course is using Introduction to Smooth Manifolds by Lee.
 A: Let's first solve the problem using Lagrange multiplier. We consider the system
$$\operatorname{grad} ((a^2 + b^2 + c^2 + d^2) - 2\lambda (a d - b c - 1)) = 0$$
that is
$$ (a,  b,  c,  d) = \lambda(d,-c,-b,a)$$
Since $a d - b c = 1$, we conclude that $\lambda = \pm 1$. Two cases:
$a = d$, $b = -c$, and $a^2 + b^2 = 1$, so
$$\left( \begin{matrix} a & b \\ c & d \end{matrix} \right) = \left( \begin{matrix} \cos \theta & - \sin \theta \\ \sin \theta & \cos \theta \end{matrix} \right)$$
and the distance squared is $2$
$a = -d$, $b=c$ implies $a d - b c \le 0$, not possible.
So the minimal distance is $2$. Let's generalize this:
Consider $A \in SL(n, \mathbb{R})$. We have $\|A\|^2 = \operatorname{trace} (A A^t)$
Since $\det (A A^t) = 1$, and $A A^t$ is positive definite, we conclude that $\operatorname{trace} (A A^t)\ge n$  ( inequality of means). We have equality if and only if all the eigenvalues of $A A^t$ are $1$, which is equivalent to $A A^t = 1$. Therefore, the minimizers are exactly the elements in $SO(n, \mathbb{R})$.
${\bf Added:}$ We could use Lagrange multipliers in the general case, and conclude that any critical point for $\|A\|^2$ on the manifold $\det A = 1$  is an element of $SO(n, \mathbb{R})$.
Let's see how we find the critical points of $\|A\|^2$ on the closed submanifold $\det A = d$, $d \ne 0$. Set up the Lagrange system and obtain that the following matrices are proportional
$$A^t \simeq \operatorname{adj} A$$
where $ \operatorname{adj} A$ is the adjugate matrix of $A$.
Now, if $d > 0$, then we obtain that $A = \sqrt[n]{d} \cdot O$, where $O \in SO(n, \mathbb{R})$, while if $d< 0$, we get
$A = \sqrt[n]{-d} \cdot O_-$, where $O_-$ is orthogonal of determinant $-1$.
A: You can actually do this with Lagrange multipliers. In the following, I always identify the matrix $\begin{pmatrix}
a & b\\
c & d
\end{pmatrix}$ with the corresponding point $(a, b, c, d) \in \mathbb{R}^4$.
First, you have to recognize that $SL(2, \mathbb{R})$ is a 3-dimensional submanifold of $\mathbb{R}^4$ defined by the simple equation $ad - bc = 1$. In other words, setting $f(a, b, c, d) = ad - bc - 1$, $SL(2, \mathbb{R})$ is defined by the equation $f(a, b, c, d) = 0$. Importantly, $f$ has nonzero gradient everywhere on $SL(2, \mathbb{R})$, which means we can use it for Lagrange multipliers.
The function you are trying to minimize is the distance function, but to simplify things, I am actually going to minimize the squared distance function, $g(a, b, c, d) = a^2 + b^2 + c^2 + d^2$. Because $SL(2, \mathbb{R})$ is a non-empty closed subset of $\mathbb{R}^4$, there is a closest point to the origin, and this closest point can be found by Lagrange multipliers.
As you know from Lagrangian multipliers, the minimum of $g$ is found when $\nabla g = \lambda \nabla f$ for some $\lambda \in \mathbb{R}$.
In other words,
$$ (2a, 2b, 2c, 2d) = \lambda (d, -c, -b, a) $$
After some algebra, this simplifies to: $a = d$ and $b = -c$ or $a = -d$ and $b = c$. In the second case, the determinant is always negative. So, if the distance to the origin is minimized, then $a = d$ and $b = -c$. If you then compute the distance, you find that all matrices in $SL(2, \mathbb{R})$ that satisfy this do have the same distance to the origin, so they are the closest matrices in $SL(2,\mathbb{R})$ to the origin.
