planerot

Givens plane rotation that zeroes the second component of a 2-element vector.

Category: Mathematics > Linear Algebra

Syntax

[G, Y] = planerot(X)

Returns the 2-by-2 rotation G such that G*X has a zero second entry, and that product as Y.

Description

A Givens rotation turns a vector in the plane onto the first axis without changing its length. It is the elementary step used to introduce zeros when triangularizing a matrix, as in QR factorization of Hessenberg or banded matrices.

Applying G to two rows of a larger matrix zeroes one entry while touching only those rows.

Input arguments

X
Column vector with two elements.

Output arguments

G
Orthogonal 2-by-2 matrix [c s; -s c] (a Givens rotation).
Y
The rotated vector G*X, whose first entry is norm(X) and whose second is zero.

Example

Rotating [3; 4]

G = planerot([3; 4])
norm(G*[3; 4])
Output
G = 2×2

    0.6000    0.8000
   -0.8000    0.6000
ans = 5

Notes

The result Y can show a tiny rounding value such as -0.0000 in the second entry instead of an exact zero.

See also

qr hess qrupdate