What's the bijection between scalar/inner products and (certain) almost complex structures (on $\mathbb R^2$)? Asked on maths overflow here.

What's the bijection between (equivalence classes of) scalar products (I guess 'scalar product' is the same as 'inner product') and a.c.s. (almost complex structure/s) on $\mathbb R^2$?
From Example 1.2.12 of Daniel Huybrechts - Complex Geometry An Introduction.




Assumptions and notation:

*

*I just pretend $V = \mathbb R^2$ literally instead of just an isomorphism.


*Let $\Phi(V)$ be the set of real symmetric positive definite $2 \times 2$ matrices. This set is in bijection with inner products on $V$, I believe. We have according to this,
$$\Phi(V) = \{\begin{bmatrix}
h & f\\ 
f & g
\end{bmatrix} \ | \ h+g, hg-f^2 > 0 \}_{h,f,g \in \mathbb R}$$


*Let $\Gamma(V)$ be the (matrix representations of) a.c.s. on $V$. We have, according to this,

$$\{\begin{bmatrix}
a & b\\ 
\frac{-1-a^2}{b} & -a
\end{bmatrix}\}_{a,b \in \mathbb R, b \ne 0}=: \Gamma(V) \subseteq Auto_{\mathbb R}(V) \subseteq End_{\mathbb R}(V)$$


*I understand that the 'rotation' matrices in $V$ are $SO(2) := \{R(\theta) := \begin{bmatrix}
\cos(\theta) & -\sin(\theta)\\ 
\sin(\theta) & \cos(\theta)
\end{bmatrix}\}_{\theta \in \mathbb R}$, though I'm not sure that Huybrechts has the same usage of the term 'rotation'. (I ask about this later.)


Questions:

A. For injectivity (except for the equivalence class):
Given (equivalence class of) scalar product ($[M]$ of) $M$, choose unique $I$ that assigns $v$ to the one described. I'll call this map $\gamma: \Phi(V) \to \Gamma(V)$, $\gamma(M)=I$. (Later, $\tilde \gamma: \frac{\Phi(V)}{\tilde{}} \to \Gamma(V)$, $\tilde \gamma([M])=I$.)

*

*It's 'rotation by $\pi/2$' or something. In what way? For $M=I_2$ (2x2 identity), then $I$ is indeed 'rotation by $\pi/2$', in the sense that it's $\begin{bmatrix}
0 & 1\\ 
-1 & 0
\end{bmatrix} \in SO(2) \cap \gamma(V)$, which is the '$R(\theta)$', for $\theta = \pi/2$.


*What exactly is the formula for $I=\begin{bmatrix}
a & b\\ 
\frac{-1-a^2}{b} & -a
\end{bmatrix} \in \Gamma(V)$ given $M = \begin{bmatrix}
h & f\\ 
f & g
\end{bmatrix} \in \Phi(V)$?
I'm asking because

*

*2a - I would exceed wolfram computation time


*2b - I notice for a different $M$ I tried, $I$ isn't a 'rotation matrix' in the sense of $SO(2)$. In fact, I believe the only 'rotation' matrices that are also a.c.s. are $\pm \begin{bmatrix}
0 & 1\\ 
-1 & 0
\end{bmatrix}$, i.e. $SO(2) \cap \gamma(V) = \{\pm \begin{bmatrix}
0 & 1\\ 
-1 & 0
\end{bmatrix}\}$. However, I think $I$ kind of 'rotates by $\pi/2$' in some other sense.


*2c - I think $SO(2) \cap \gamma(V)$ isn't meant to be the image of $\gamma$

B. For surjectivity:
I'll call whatever map we would have as $\phi: \Gamma(V) \to \Phi(V)$, $\phi(I)=M$


*Given an a.c.s. $I$, what are some possible scalar products $M$?


*There's a comment that goes choosing the unique $M_v$ such that for some $v \in V \setminus 0$, we have $\{v,I(v)\}$ as an orthonormal basis. I tried this out (long to type!), and the only thing missing was the positively oriented. I guess either $\{v,I(v)\}$ or $\{v,-I(v)\}$ is positively oriented though. So I'll let $M_v$/$N_v \in \Phi(V)$ correspond to $\{v,I(v)\}$/$\{v,-I(v)\}$. Then by fixing $v$ (I ask about non-fixing of $v$ later), we have $\phi(I)=M_v$ or $N_v$, whichever corresponds to positively oriented basis. I'll just call this $\phi(I)=L_v$ Is this right?


*Is $\phi$ supposedly an inverse (or right inverse or left inverse or whatever) to $\gamma$ (or $\tilde \gamma$ or whatever), in the sense that $\gamma(\phi(I)) = I$ for all (a.c.s.) $I \in \Gamma(V)$?


*This whole thing about the $v$ makes me think there's another equivalence relation going on here. Is there?
This seems like we can have maps parametrised by the nonzero $v$, namely $\phi_v: \Gamma(V) \to \Phi(V)$. In this case, we might investigate if $\phi_v(I)=L_v=L_w=\phi_w(I)$ or at least if $[L_v]=[L_w]$ under the old equivalence relation of positive scalar $\lambda$, i.e. $L_v = \lambda L_w$. If this investigation turns out negative, then I think there's some problem like if 2 inner products are equivalent if they are from the same a.c.s. $I$ under $\phi_{\cdot}$, but for possibly different $v$ and $w$, then I think the equivalence class of $L_v$ under this new relation, which is $\{L_w\}_{w \ne 0}$, might not be the same as the equivalence class of $L_v$ under the old relation, which is $\{\lambda L_v\}_{\lambda > 0}$.

Ideas:

*

*Perhaps there's some matrix thing here about how scalar products are in bijection with positive definite symmetric matrices and then almost complex structures are rotation matrices or something that are square roots of $-I_2$. Like given pos def symmetric $B$, there exists unique a.c.s. $J$ such that (something something).


*Perhaps this is related, but I'd rather not further analyse the question or read through the answer given that I've spent over a month on almost complex structures BEFORE we even put inner products on vector spaces. Please consider spoon-feeding me here.
 A: Fix a two-dimensional real vector space $V$. There are three kinds of extra data we can impose upon $V$:

*

*An orientation, a function $\omega$ which measures a basis $(v_1, v_2)$ and outputs $\omega(v_1, v_2) \in \{\pm 1\}$.

*A complex structure, an $\mathbb{R}$-linear operator $I \colon V \to V$ satisfying $I^2 = -\operatorname{id}_V$.

*A scalar product $B \colon V \times V \to \mathbb{R}$, which is bilinear, symmetric, and positive-definite.

For example, when $V = \mathbb{R}^2$ and $(e_1, e_2)$ is the standard basis, then we have the standard structures:

*

*The orientation of a basis $(v_1, v_2)$ is the sign of the determinant of the change-of-basis matrix from $(e_1, e_2)$ to $(v_1, v_2)$.

*The complex structure is a rotation counter-clockwise by $\pi/2$, the linear operator defined by $I e_1 = e_2$ and $I e_2 = -e_1$.

*The dot product $B(e_1, e_1) = B(e_2, e_2) = 1$ and $B(e_1, e_2) = 0$.

When I say "the" rotation by $\pi/2$, I am really using both the orientation and the scalar product implicitly. An algebraic rotation by $\pi/2$ is simply an operator $I$ squaring to $I^2 = - \operatorname{id}_V$, and there are many operators of this form. For example, I could define $J e_1 = 2 e_1 + 3e_2$ and $J(2e_1 + 3e_2) = -e_1$ and $J$ would be an algebraic rotation by $\pi/2$.
Keep in mind that if $V$ is just a two-dimensional real vector space with no more data, we cannot possibly say if something preserves lengths or angles, think for example of the two-dimensional vector space of functions $f \colon \mathbb{R} \to \mathbb{R}$ spanned by $e^x$ and $\sin x$: is the operator $I(e^x) = \sin x$ and $I(\sin x) = -e^x$ a true "rotation"? We cannot possibly say before we define an inner product on the space, but it is certainly an algebraic rotation since it squares to minus one.
Things brings us to standard notions for "compatibility" of a complex structure with the above:

*

*A complex structure $I$ is compatible with the scalar product $B$ if it is an isometry: $B(Iv_1, Iv_2) = B(v_1, v_2)$ for all $v_1, v_2 \in V$.

*A complex structure $I$ is compatible with the orientation if $(v, Iv)$ is positively oriented for any $v \in V$.

Lemma: If $(V, \omega, B)$ is a two-dimensional real vector space equipped with an orientation $\omega$ and scalar product $B$, then there is a unique compatible complex structure $I \colon V \to V$.
Proof: Since $I$ is an isometry it preserves lengths: $B(v, v) = B(Iv, Iv)$ for all $v \in V$. Furthermore, we have $B(v, Iv) = B(Iv, I^2 v) = -B(v, Iv)$ and hence $v$ and $Iv$ are perpendicular for all $v \in V$. Therefore $Iv$ lies in the one-dimensional subspace perpendicular to $v$, and must be one of the two vectors on this line which have the same length as $v$. Out of these two possibilities for $Iv$ we take the one where $\omega(v, Iv) = 1$.

Now, fix an oriented two-dimensional vector space $(V, \omega)$. Define
$$S = \{B \colon V \times V \to \mathbb{R} \mid B \text{ a scalar product}\},$$ $$C = \{I \colon V \to V \mid I^2 = -\operatorname{id}_V \text{ and } \omega(v, Iv) = 1 \text{ for all } v \in V \}$$
$$ \Phi \colon S \to C, \quad \Phi(B) = I_B $$
where $I_B$ is the unique complex structure compatible with the data $(V, \omega, B)$. We want to show that $\Phi$ is surjective, and that whenever $\Phi(B) = \Phi(D)$ then $B = \lambda D$ for some $\lambda \in \mathbb{R}_{>0}$.
Surjectivity: Let $I$ be a complex structure on $V$ compatible with $\omega$. Pick any vector $v \in V$, then $(v, Iv)$ is a positively oriented basis. Define a scalar product $B$ by setting $B(v, v) = B(Iv, Iv) = 1$ and $B(v, Iv) = 0$, in other words $B$ is defined so that $(v, Iv)$ is an orthonormal basis. Since $I$ is compatible with both $\omega$ and $B$, we have that $I = I_B = \Phi(B)$.
"Injectivity": Suppose that $I_B = I_D$ for two scalar products $B, D$. Then $(v, I_B v)$ is a positively oriented orthogonal basis for both $B$ and $D$. Hence there are positive scalars $\lambda, \mu$ such that $(\lambda v, \lambda I_B v)$ and $(\mu v, \mu I_B v)$ are positively oriented orthonormal bases for  $B$ and $D$ respectively, and therefore $\frac{1}{\lambda} B = \frac{1}{\mu} D$. (If this does not convince you, do the simple exercise: a scalar product is entirely determined by an orthonormal basis).

Hopefull that is enough: it is a very drawn out explanation. Intuitively, complex structures are algebraic rotations. A scalar product defines a circle in the space (vectors of unit length) and angles in the space, and an orientation tells you which way around the circle is the "positive" way, hence you get a unique compatible complex structure in the presence of an scalar product and orientation. Scaling up/down the scalar product (making the "unit" circle larger or smaller) doesn't change angles or rotations.
A: This answer addresses the "injectivity" questions you ask.

*

*I interpret "rotation" as "orientation preserving, and also preserving of the inner proudct".  If your inner product is the standard one on $\mathbb{R}^2$, then these corresponds to rotation matrices as you've defined them.  However, in a different inner product, the rotation matrices look different.  In this iterpretation, saying $I$ is rotation by $\pi/2$ just means that $I$ preserves lengths (as computed in the weird inner product), and the angle between $v$ and $I(v)$ (as computed in the weird inner product) is $\pi/2$.


*The matrix of $I$ is $\begin{bmatrix} -\frac{f}{\sqrt{gh-f^2}} & -\frac{g}{\sqrt{gh-f^2}} \\ \frac{h}{\sqrt{gh-f^2}}  & \frac{f}{\sqrt{gh-f^2}}\end{bmatrix}.$  I found this by setting $I\begin{bmatrix} 1\\0\end{bmatrix}= \alpha \begin{bmatrix} 1\\0\end{bmatrix} + \beta \begin{bmatrix} 0\\1\end{bmatrix}$ and then using the two equations $\left\| \begin{bmatrix} 1\\0\end{bmatrix}\right\| = \left\| I\begin{bmatrix} 1\\0\end{bmatrix}\right\|$ and $\left\langle \begin{bmatrix} 1\\0\end{bmatrix}, I\begin{bmatrix} 1\\0\end{bmatrix} \right\rangle = 0$ to solve for $\alpha$ and $\beta$.  It turns out there is a sign ambiguity which is resolved using the orientation.  I believe this answers 2a; I think 1. answers 2b and 2c.
A: DISCLAIMER: posting as answer instead of comment since too long for comment. You could think of this as a Cunningham's law thing or whatever, but I'm really doing this just because it's too long for a comment. I'm also going to do community wiki if this makes any difference.
TL;DR I think the bijection can be summed up in this formula (based on Jason DeVito's explicit computation of $I$)
$$\frac{MI}{\sqrt{\det(M)}} = J$$

Edit: Adding my intuition:

*

*Given $M$, we want unique $I$ such that $I$ is something like '(anti-clockwise) rotation by $\frac{\pi}{2}$' but 'with respect to $M$'. In precise terms, this is the unique $I$ s.t. $\frac{MI}{\sqrt{\det(M)}} = J$, where $J$ is literally (anti-clockwise) rotation by $\frac{\pi}{2}$ ('with respect to $I_2$' or something)


*Similarly, given $I$, we want an $M$ such that $I$ is '(anti-clockwise) rotation by $\frac{\pi}{2}$' but 'with respect to $M$'. Turns out there are several $M$'s that satisfy this condition, where this condition is stated in precise terms as $\frac{MI}{\sqrt{\det(M)}} = J$.

The bijection is:

*

*From $M$ to $I_M$: Given $M$, choose unique $I_M = M^{-1}J\sqrt{\det(M)}$


*From $I$ to $[M_I]$: Given $I$, choose unique equivalence class $[M_I]$ given by all $M_I$ such that $\frac{M_I}{\sqrt{\det(M_I)}} = JI^{-1} = -JI$


*Injectivity (of map $M$ to $I_M$): Given $M$ and $I_M=I_N$, I believe Joppy's $\lambda$ and $\mu$ divide to give ratio or square root of ratio of determinants


*Surjectivity (of map $M$ to $I_M$): Given $I$, there exists a lot of $M$, namely $[M_I]$.
Joppy and Jason DeVito, I've done some analysis of your answers. Follow-up questions:
FUP1 - What do you think of the above formula, with $M$ as inner product, $I$ as almost complex structure and $J$ as rotation matrix by $\frac{\pi}{2}$? I think this encapsulates all 3 properties of I. In particular...
FUP2 - I think the positively oriented is given in choosing $J$ instead of $-J$ (rotation matrix by $\frac{-\pi}{2}$)?

*

*FUP2a - In this case, I think the 1st 2  properties of unique $I$ given $M$ (respectively, $v^TMIv=0$ and $v^T(I^TMI-M)v=0$, for all nonzero $v$)  is equivalent to $\frac{MI}{\sqrt{\det(M)}} = \pm J$?

FUP3 - We can see the that the $\lambda$ between $M$'s is given by square root of ratio of determinants:

*

*FUP3a - For $\frac{M}{\sqrt{\det(M)}} = \frac{N}{\sqrt{\det(N)}} \implies M=\lambda N, \lambda=\frac{\sqrt{\det(M)}}{\sqrt{\det(N)}}$?

*

*FUP3ai - I think in this part we do not assume that each matrix $\frac{M}{\sqrt{\det(M)}}$, $\frac{N}{\sqrt{\det(N)}}$ is equal to $JI^{-1} = -JI$?



*FUP3b - Conversely for $M=\lambda N$ and $\lambda > 0$, we can take $\det$ of both sides to get $\frac{M}{\sqrt{\det(M)}} = \frac{N}{\sqrt{\det(N)}}$?

*

*FUP3bi - In particular, we can the relevance of $2$ dimensions here: taking determinant of both sides of $M=\lambda N$ gives us a $\lambda^2$?



