---
title: "Linear Algebra Bridge"
jupyter: python3
---

Review vectors, matrices, inner products, norms, eigenvectors, and singular values only when the main course requires them.

```{python}
#| label: fig-app-linear-map
#| fig-cap: "A linear map transforms a circle into an ellipse."
#| fig-alt: "Unit circle points mapped by a two-by-two matrix to an elongated rotated ellipse."

import matplotlib.pyplot as plt
import torch

angle = torch.linspace(0, 2 * torch.pi, 200)
circle = torch.stack([torch.cos(angle), torch.sin(angle)])
matrix = torch.tensor([[2.0, 0.8], [0.2, 0.7]])
transformed = matrix @ circle

plt.figure(figsize=(5, 4))
plt.plot(circle[0], circle[1], label="unit circle")
plt.plot(transformed[0], transformed[1], label="linear image")
plt.axis("equal")
plt.legend()
plt.tight_layout()
plt.show()
```
