# Nakafa Learning Content

> For AI agents: use [llms.txt](https://nakafa.com/llms.txt) for the site index. Markdown versions are available by appending `.md` to content URLs or sending `Accept: text/markdown`.

URL: https://nakafa.com/en/subjects/ai-ds/linear-methods/orthogonal-unitary-matrix
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/material/lesson/ai-ds/linear-methods/orthogonal-unitary-matrix/en.mdx

Learn orthogonal and unitary matrices through determinant properties, eigenvalue analysis, rotation examples, and linear algebra applications.

---

## Getting to Know Orthogonal and Unitary Matrices

Orthogonal and unitary matrices are very special types of matrices. Imagine them as "clean" transformations that don't change distances and angles in space, only rotating or reflecting objects.

The difference is simple. Orthogonal matrices work with real numbers, while unitary matrices work with complex numbers. Both have the same properties, just different versions.

## Mathematical Definitions

### Orthogonal Matrices

A square real matrix $$A \in \mathbb{R}^{n \times n}$$ is called **orthogonal** if:

Visible text: A square real matrix is called **orthogonal** if:

```math
A^{-1} = A^T
```

This means, to get the inverse of this matrix, we just transpose it. Very practical, right?

This is equivalent to:

```math
A^T A = A A^T = I
```

### Unitary Matrices

A square complex matrix $$A \in \mathbb{C}^{n \times n}$$ is called **unitary** if:

Visible text: A square complex matrix is called **unitary** if:

```math
A^{-1} = A^H
```

Here $$A^H$$ is the conjugate transpose of $$A$$. The concept is similar, just for complex numbers.

Visible text: Here is the conjugate transpose of . The concept is similar, just for complex numbers.

This is also equivalent to:

```math
A^H A = A A^H = I
```

> Real orthogonal matrices are actually a special case of unitary matrices, since $$\mathbb{R}^{n \times n} \subset \mathbb{C}^{n \times n}$$.

Visible text: > Real orthogonal matrices are actually a special case of unitary matrices, since .

## Interesting Determinant Properties

What's interesting about orthogonal and unitary matrices is that their determinants always have absolute value $$1$$. Why is this?

Visible text: What's interesting about orthogonal and unitary matrices is that their determinants always have absolute value . Why is this?

For a unitary matrix $$A$$, we have $$A^H A = I$$. If we calculate its determinant:

Visible text: For a unitary matrix , we have . If we calculate its determinant:

Component: MathContainer
Children:

```math
1 = \det I = \det(A^H A) = \det A^H \cdot \det A = \overline{\det A} \cdot \det A = |\det A|^2
```

So $$|\det A| = 1$$. For orthogonal matrices, the proof is the same, just using $$A^T A = I$$.

Visible text: So . For orthogonal matrices, the proof is the same, just using .

## Special Eigenvalues

Eigenvalues of orthogonal and unitary matrices also have special properties. Every eigenvalue $$\lambda$$ always satisfies:

Visible text: Eigenvalues of orthogonal and unitary matrices also have special properties. Every eigenvalue always satisfies:

```math
|\lambda| = 1
```

Why is this? Suppose $$A \cdot v = \lambda \cdot v$$ for an eigenvector $$v \neq 0$$. For the complex case, we can calculate:

Visible text: Why is this? Suppose for an eigenvector . For the complex case, we can calculate:

Component: MathContainer
Children:

```math
v^H v = v^H A^H A v = (A \cdot v)^H (A \cdot v) = (\lambda \cdot v)^H (\lambda \cdot v)
```

```math
= \overline{\lambda} \cdot \lambda \cdot v^H v = |\lambda|^2 \cdot v^H v
```

Since $$v^H v \neq 0$$, then $$|\lambda|^2 = 1$$, so $$|\lambda| = 1$$.

Visible text: Since , then , so .

## Forms of Eigenvalues

For real orthogonal matrices, the eigenvalues can be $$1$$ or $$-1$$ if real. But if complex, they can be written as:

Visible text: For real orthogonal matrices, the eigenvalues can be or if real. But if complex, they can be written as:

```math
\lambda = \exp(i\varphi) = \cos \varphi + i \sin \varphi
```

This means complex eigenvalues lie on the unit circle in the complex plane.

## Concrete Example of Rotation Matrix

Let's look at a familiar example, the rotation matrix:

```math
A = \begin{pmatrix} \cos \alpha & -\sin \alpha \\ \sin \alpha & \cos \alpha \end{pmatrix}
```

We can check that this is an orthogonal matrix:

Component: MathContainer
Children:

```math
A^T A = \begin{pmatrix} \cos \alpha & \sin \alpha \\ -\sin \alpha & \cos \alpha \end{pmatrix} \begin{pmatrix} \cos \alpha & -\sin \alpha \\ \sin \alpha & \cos \alpha \end{pmatrix}
```

```math
= \begin{pmatrix} \cos^2 \alpha + \sin^2 \alpha & \cos \alpha(-\sin \alpha) + \sin \alpha \cos \alpha \\ (-\sin \alpha) \cos \alpha + \cos \alpha \sin \alpha & (-\sin \alpha)(-\sin \alpha) + \cos^2 \alpha \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}
```

### Finding Eigenvalues

The characteristic polynomial is:

Component: MathContainer
Children:

```math
\chi_A(t) = \det \begin{pmatrix} \cos \alpha - t & -\sin \alpha \\ \sin \alpha & \cos \alpha - t \end{pmatrix}
```

```math
= (\cos \alpha - t)^2 + \sin^2 \alpha = \cos^2 \alpha + \sin^2 \alpha - 2t \cos \alpha + t^2
```

```math
= 1 - 2t \cos \alpha + t^2
```

The eigenvalues are:

```math
\lambda_{1,2} = \cos \alpha \pm \sqrt{\cos^2 \alpha - 1} = \cos \alpha \pm \sqrt{-\sin^2 \alpha} = \cos \alpha \pm i \sin \alpha
```

The result is $$\lambda_{1,2} = e^{\pm i\alpha}$$.

Visible text: The result is .

The transformation $$\mathbb{R}^2 \to \mathbb{R}^2 : x \mapsto A \cdot x$$ represents a rotation by angle $$\alpha$$. For $$\alpha \neq 0$$ and $$\alpha \neq \pi$$, this matrix has no real eigenvalues, but has two complex eigenvalues.

Visible text: The transformation represents a rotation by angle . For and , this matrix has no real eigenvalues, but has two complex eigenvalues.