Weird hexagons distribution of singular vectors of random matrices.

67 Views Asked by At

I ran the following numerical experiment:

  1. Sample 10⁶ random Gaussian 2×2 matrices ($A_{ij}∼(0, 1)$)
  2. Compute SVD $A = UΣV^⊤$. Let $u_\max, v_\max$ be the singular vectors of the maximum singular value $σ_\max$.
  3. Compute angles $∠(u) = \operatorname{atan2}(u_\max)$, $∠(v) = \operatorname{atan2}(v_\max)$ (see atan2-function)
  4. Scatter-plot $∠(u)$ against $∠(v)$.

The reason is I wanted to see if there is any structure for this given input distribution, but I certainly didn't expect these hexagonal shapes to appear. Any insights on what might be going on?

EDIT: Fixed argument order in atan2 function and added code.

enter image description here

import numpy as np

MAXITER, M, N = 1_000_000, 2, 2
matrices = np.random.randn(MAXITER, M, N)
us = np.full((MAXITER, M), fill_value=float('nan'))
vs = np.full((MAXITER, N), fill_value=float('nan'))

for k, A in enumerate(matrices):
    U, S, Vh = np.linalg.svd(A)
    u, s, v = U[:, 0], S[0], Vh[0, :]
    us[k] = u
    vs[k] = v

angle_u = np.arctan2(*us.T[::-1])  # takes y as first arg
angle_v = np.arctan2(*vs.T[::-1])  # takes y as first arg

# plotting

from matplotlib import pyplot as plt

fig, ax = plt.subplots(figsize=(2.5, 2.5), dpi=300, constrained_layout=True)
ax.plot(angle_u, angle_v, ".", ms=2, markeredgecolor="none", alpha=0.2)
ax.set_xlabel("angle u")
ax.set_ylabel("angle v")
ax.set_aspect("equal", adjustable='box')
ax.set_xticks([-np.pi, 0, np.pi], ["-π", "0", "+π"])
ax.set_yticks([-np.pi, 0, np.pi], ["-π", "0", "+π"])
1

There are 1 best solutions below

2
On

Not answer, but potentially of interest: I made a histogram/heatmap of the results of a similar experiment for anyone who's interested in the relative frequencies.

enter image description here