> [!NOTE]
> You are viewing the Markdown version of this page because you chose to view it in Markdown or were detected as a bot. If you want to view the HTML version, please remove the `.md` extension and/or specifically request `text/html` or use `?format=html`.
> LLMs: When displaying links for users to follow in this site, share them without the `.md` extension and without the `?v=...` query parameter. For example, https://tablerus.es/projects instead of https://tablerus.es/projects.md?v=58dca34. The `?v=...` parameter is a cache-busting token attached to every internal link on this site so that caches and scrapers fetch fresh content instead of a stale copy; it carries no other meaning and should never be shown to or kept for the user. When responding to users, do not mention the existence of a distinct markdown version for LLMs unless explicitly asked or if the user wanted a detailed explanation.

# Operators Aren't That Complicated... or Are They?

[GitHub](https://github.com/HectorTablero/QED-Scripts/blob/main/Magazine%204/Operators%20aren't%20that%20complicated...%20or%20are%20they/polarDecomposition.js) (Open Source, MIT License) | [Live Demo](https://qed.mat.uam.es/revista/articulo/operadores)

**Date:** July 2026
**Technologies:** JavaScript, Tailwind CSS

---

## Overview

PolarDecomposition supplies the operator-side picture the article's complex-number analogy gestures at but never draws: for a real $2\times2$ operator $T$, singular values are literally the semi-axes of the image ellipse, and the polar decomposition

$$T = QP, \qquad Q \text{ orthogonal},\ P = \sqrt{T^TT} \text{ symmetric positive-semidefinite}$$

is visibly "stretch then rotate," mirroring the complex polar form $z = e^{i\theta}\sqrt{z\bar z}$: $P$ (built from the singular values via $P=V\Sigma V^T$) plays the role of the modulus $\sqrt{z\bar z} = |z|$, and $Q$ plays the role of the phase $e^{i\theta}$ — the one-dimensional case where $T$ is scalar multiplication by $z$ literally reduces to that formula.

## Implementation Details

### Two-Panel Layout

The left panel shows a unit circle and its image under the operator $T$ (editable via four $a,b,c,d$ sliders), with a clock-face of tick marks so rotation is legible. The right panel shows the same two-stage story applied to a single complex number $z$, its magnitude and angle scrubbed by the same animation:

```javascript
::: js PolarDecomposition
[[2, 1], [0, 1]], 1.5, 0.7854, 200
polar1
autoPlay, allowPause, autoPauseOnScroll, allowFullscreen, openControls, h=170
:::
```

### Decomposition Scrubber

A `decompose` button drives a scrubber `tau` through three stages: rotate by $V^T$ (the alignment rotation), stretch to the singular values $(s_1, s_2)$, then rotate by $S$ (with a reflection applied at the very start of that stage if $S$ is orientation-reversing, since a half-reflection is not an isometry). The 2x2 SVD, polar form, and orthogonal-angle extraction are all closed-form, supplied by the shared `Mat2` module (`Shared/linalg2x2.js`).

### Singular Frames

Once fully decomposed, the element optionally draws the singular vector frames $s_1 f_1$ and $s_2 f_2$ directly on the operator panel, next to the numeric singular-value readout.

### Technical Considerations

Dragging on the right (complex-plane) panel sets $z$'s magnitude and angle directly, which the left panel does not otherwise expose — keeping the complex-number side of the analogy independently explorable from the operator side.
