Kleinste-Quadrate-Probleme durch die QR-Zerlegung lösen

Kleinste-Quadrate-Probleme über die QR-Faktorisierung lösen

Während der Ansatz über die Normalgleichungen (\( A^T A \hat{x} = A^T B \)) einen direkten Weg zur Lösung von Kleinste-Quadrate-Problemen bietet, kann die Berechnung des Matrixprodukts \( A^T A \) manchmal die numerische Stabilität und Rundungsfehler verschlechtern. Um dies zu umgehen, greift die lineare Algebra auf die QR-Zerlegung als eine stabilere, orthogonale Alternative zurück.

Durch die Faktorisierung der Matrix \( A \) in eine orthogonale Matrix \( Q \) und eine obere Dreiecksmatrix \( R \) (sodass \( A = QR \)) vereinfacht sich das Kleinste-Quadrate-Problem erheblich. Wie in Linear Algebra and its Applications gezeigt, kann die Näherungslösung \( \hat{x} \) direkt aus der Gleichung gefunden werden:

$$ R \hat{x} = Q^T B $$

wobei \( Q^T \) die Transponierte der Matrix \( Q \) ist und \( R \) eine obere Dreiecksmatrix. Da \( R \) eine obere Dreiecksmatrix ist, kann dieses System sehr effizient mithilfe des Rückwärtseinsetzens gelöst werden, ohne dass jemals \( A^T A \) berechnet werden muss.

Beispiele mit Lösungen

Beispiel 1

Verwenden Sie die QR-Zerlegung, um das Kleinste-Quadrate-Problem für das inkonsistente System \( Ax = B \) zu lösen mit:

$$ A = \begin{bmatrix} 2 & 0 \\ 0 & 1 \\ 1 & 2 \end{bmatrix} \quad \text{und} \quad B = \begin{bmatrix} 1 \\ 0 \\ 3 \end{bmatrix} $$
Lösung zu Beispiel 1 anzeigen

Schritt 1: Orthogonale Matrix Q bestimmen

Verwenden Sie das Gram-Schmidt-Verfahren, um die orthogonale Matrix \( Q \) zu finden und die Matrix \( A \) in \( A = QR \) zu zerlegen.

$$ Q = \begin{bmatrix} \frac{2\sqrt{5}}{5} & \frac{-4\sqrt{105}}{105} \\ 0 & \frac{\sqrt{105}}{21} \\ \frac{\sqrt{5}}{5} & \frac{8\sqrt{105}}{105} \end{bmatrix} $$

Schritt 2: Matrix R berechnen

Multiplizieren Sie beide Seiten von \( A = QR \) mit \( Q^T \) (der Transponierten von \( Q \)). Da \( Q \) orthogonal ist, gilt \( Q^T Q = I \), was die Gleichung zu \( R = Q^T A \) vereinfacht.

Schreiben Sie zunächst die Transponierte von \( Q \):

$$ Q^T = \begin{bmatrix} \frac{2\sqrt{5}}{5} & 0 & \frac{\sqrt{5}}{5} \\ \frac{-4\sqrt{105}}{105} & \frac{\sqrt{105}}{21} & \frac{8\sqrt{105}}{105} \end{bmatrix} $$

Berechnen Sie nun \( R \):

$$ R = Q^T A = \begin{bmatrix} \frac{2\sqrt{5}}{5} & 0 & \frac{\sqrt{5}}{5} \\ \frac{-4\sqrt{105}}{105} & \frac{\sqrt{105}}{21} & \frac{8\sqrt{105}}{105} \end{bmatrix} \begin{bmatrix} 2 & 0 \\ 0 & 1 \\ 1 & 2 \end{bmatrix} = \begin{bmatrix} \sqrt{5} & \frac{2}{\sqrt{5}} \\ 0 & \sqrt{\frac{21}{5}} \end{bmatrix} $$

Schritt 3: \( Q^T B \) berechnen

$$ Q^T B = \begin{bmatrix} \frac{2\sqrt{5}}{5} & 0 & \frac{\sqrt{5}}{5} \\ \frac{-4\sqrt{105}}{105} & \frac{\sqrt{105}}{21} & \frac{8\sqrt{105}}{105} \end{bmatrix} \begin{bmatrix} 1 \\ 0 \\ 3 \end{bmatrix} = \begin{bmatrix} \sqrt{5} \\ \frac{4\sqrt{5}}{\sqrt{21}} \end{bmatrix} $$

Schritt 4: \( R \hat{x} = Q^T B \) lösen

Setzen Sie \( R \) und \( Q^T B \) in das System ein:

$$ \begin{bmatrix} \sqrt{5} & \frac{2}{\sqrt{5}} \\ 0 & \sqrt{\frac{21}{5}} \end{bmatrix} \hat{x} = \begin{bmatrix} \sqrt{5} \\ \frac{4\sqrt{5}}{\sqrt{21}} \end{bmatrix} $$

Da \( R \) eine obere Dreiecksmatrix ist, können wir dies schnell mithilfe des Rückwärtseinsetzens lösen und erhalten die endgültige Näherungslösung:

$$ \hat{x} = \begin{bmatrix} \frac{13}{21} \\ \frac{20}{21} \end{bmatrix} $$

Beispiel 2

Verwenden Sie die QR-Zerlegung, um das Kleinste-Quadrate-Problem für das inkonsistente System \( Ax = B \) zu lösen mit:

$$ A = \begin{bmatrix} 1 & 0 & 1 \\ 2 & 0 & 0 \\ 0 & -1 & 1 \\ 0 & -2 & 0 \end{bmatrix} \quad \text{und} \quad B = \begin{bmatrix} 2 \\ 3 \\ 4 \\ 7 \end{bmatrix} $$
Lösung zu Beispiel 2 anzeigen

Schritt 1: Orthogonale Matrix Q bestimmen

Verwenden Sie das Gram-Schmidt-Verfahren auf die Matrix \( A \), um die orthogonale Matrix \( Q \) zu finden.

$$ Q = \begin{bmatrix} \frac{\sqrt{5}}{5} & 0 & \frac{\sqrt{10}}{5} \\ \frac{2\sqrt{5}}{5} & 0 & -\frac{\sqrt{10}}{10} \\ 0 & -\frac{\sqrt{5}}{5} & \frac{\sqrt{10}}{5} \\ 0 & -\frac{2\sqrt{5}}{5} & -\frac{\sqrt{10}}{10} \end{bmatrix} $$

Schritt 2: Matrix R berechnen

Unter Verwendung der Eigenschaft \( R = Q^T A \) bestimmen wir zunächst die Transponierte \( Q^T \):

$$ Q^T = \begin{bmatrix} \frac{\sqrt{5}}{5} & \frac{2\sqrt{5}}{5} & 0 & 0 \\ 0 & 0 & -\frac{\sqrt{5}}{5} & -\frac{2\sqrt{5}}{5} \\ \frac{\sqrt{10}}{5} & -\frac{\sqrt{10}}{10} & \frac{\sqrt{10}}{5} & -\frac{\sqrt{10}}{10} \end{bmatrix} $$

Berechnen Sie nun \( R \):

$$ R = Q^T A = \begin{bmatrix} \frac{\sqrt{5}}{5} & \frac{2\sqrt{5}}{5} & 0 & 0 \\ 0 & 0 & -\frac{\sqrt{5}}{5} & -\frac{2\sqrt{5}}{5} \\ \frac{\sqrt{10}}{5} & -\frac{\sqrt{10}}{10} & \frac{\sqrt{10}}{5} & -\frac{\sqrt{10}}{10} \end{bmatrix} \begin{bmatrix} 1 & 0 & 1 \\ 2 & 0 & 0 \\ 0 & -1 & 1 \\ 0 & -2 & 0 \end{bmatrix} = \begin{bmatrix} \sqrt{5} & 0 & \frac{1}{\sqrt{5}} \\ 0 & \sqrt{5} & -\frac{1}{\sqrt{5}} \\ 0 & 0 & \frac{2\sqrt{2}}{\sqrt{5}} \end{bmatrix} $$

Schritt 3: \( Q^T B \) berechnen

$$ Q^T B = \begin{bmatrix} \frac{\sqrt{5}}{5} & \frac{2\sqrt{5}}{5} & 0 & 0 \\ 0 & 0 & -\frac{\sqrt{5}}{5} & -\frac{2\sqrt{5}}{5} \\ \frac{\sqrt{10}}{5} & -\frac{\sqrt{10}}{10} & \frac{\sqrt{10}}{5} & -\frac{\sqrt{10}}{10} \end{bmatrix} \begin{bmatrix} 2 \\ 3 \\ 4 \\ 7 \end{bmatrix} = \begin{bmatrix} \frac{8}{\sqrt{5}} \\ -\frac{18}{\sqrt{5}} \\ \sqrt{\frac{2}{5}} \end{bmatrix} $$

Schritt 4: \( R \hat{x} = Q^T B \) lösen

Stellen Sie das Gleichungssystem auf, indem Sie die berechneten Werte einsetzen:

$$ \begin{bmatrix} \sqrt{5} & 0 & \frac{1}{\sqrt{5}} \\ 0 & \sqrt{5} & -\frac{1}{\sqrt{5}} \\ 0 & 0 & \frac{2\sqrt{2}}{\sqrt{5}} \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} = \begin{bmatrix} \frac{8}{\sqrt{5}} \\ -\frac{18}{\sqrt{5}} \\ \sqrt{\frac{2}{5}} \end{bmatrix} $$

Das Lösen dieses Dreieckssystems ergibt:

\( x_1 = \frac{3}{2} \), \( x_2 = -\frac{7}{2} \), \( x_3 = \frac{1}{2} \)

Die endgültige Näherungslösung lautet:

$$ \hat{x} = \begin{bmatrix} \frac{3}{2} \\ -\frac{7}{2} \\ \frac{1}{2} \end{bmatrix} $$

Weitere Referenzen und Links

  1. Vektorräume – Aufgaben mit Lösungen
  2. Kleinste-Quadrate-Probleme über die Normalgleichungen lösen
  3. Linear Algebra and its Applications – 5. Auflage – David C. Lay, Steven R. Lay, Judi J. McDonald
  4. Elementary Linear Algebra – 7. Auflage – Howard Anton and Chris Rorres