Solution

ID: past-exam-of-the-numerical-analysis-course-of-the-university-of-oxford/2015/3/c/ii/solution

Let . If , choose so that
Such an angle exists because the two ratios have squared sum one. Then the changed coordinates are
All other coordinates satisfy . If , both input coordinates are zero; take , giving the identity matrix on this pair. In all cases,
This fixes a nonnegative retained coordinate and handles division by zero explicitly. For floating-point computation, the stable construction of a Givens rotation uses scaled Euclidean norm evaluation to avoid unnecessarily overflowing or underflowing the squares.

New to topics? Read the docs here!