Orthogonality, measured

The nearest orthogonal matrix

Every field that has to clean up a drifted rotation reaches for QR, and QR does not answer the question. The nearest orthogonal matrix is the orthogonal factor of the polar decomposition — nearer by about a tenth, and, more to the point, the same matrix whatever order the columns were written in. QR's answer changes completely.

Worth reading first: Orthogonal is a number · The best approximation there is.

A rotation matrix in a robot’s state estimator drifts. A basis in a subspace iteration stops being orthonormal. A transformation fitted to noisy point pairs comes out not quite orthogonal. In every case somebody has a matrix that is nearly orthogonal and wants the orthogonal matrix nearest to it, and in every case the answer written down is QR.

It is the wrong answer, and the interesting part is not by how much.

‖A − Q‖_F for four orthogonal matrices, on an 8×8 matrix with κ = 10The polar factor is 1.8554 from A. QR with its column signs fixed is 2.1265 — 15 per cent further. QR as Householder returns it, with 7 of 8 columns negated, is 3.8226, which is further than the best of two hundred orthogonal matrices drawn at random. The strip beneath the bars is those two hundred draws, whose best is 2.6928; the polar factor is to the left of all of them, which is the minimisation being checked rather than assumed.how far is it from A to an orthogonal matrix?smaller is nearer · the polar factor minimises this in every unitarily invariant normpolar factor U1.8554QR, signs fixed2.1265QR as returned3.8226200 drawn at randomκ = 10polar factor1.9QR, signs fixed2.1QR as returned3.8best of 200 random2.7‖A − QR‖ is the same either wayand ‖A − Q‖ is not
Fig. 1 How far A is from four orthogonal matrices: the polar factor, QR with its column signs fixed, QR as Householder returns it, and the best of two hundred drawn at random. Drag the condition number of A.

What the nearest orthogonal matrix is

Write A = PΣQᵀ, its singular value decomposition. Then

A  =  (PQᵀ)(QΣQᵀ)  =  U H

with U = PQᵀ orthogonal and H = QΣQᵀ symmetric positive semidefinite. That is the polar decomposition, and U is the nearest orthogonal matrix to A in the Frobenius norm, in the spectral norm, and in every unitarily invariant norm — one matrix minimising all of them at once, which is a stronger statement than it looks.

The proof is one line once the SVD is in hand: for orthogonal W,

‖A − W‖_F²  =  ‖Σ − PᵀWQ‖_F²

and PᵀWQ is orthogonal, so the closest it can come to a diagonal of positive numbers is the identity, which is W = PQᵀ. Nothing to choose.

‖A − Q‖_F for four orthogonal matrices, on an 8×8 matrix with κ = 10000The polar factor is 2.5188 from A. QR with its column signs fixed is 2.8670 — 14 per cent further. QR as Householder returns it, with 5 of 8 columns negated, is 3.1329, which is further than the best of two hundred orthogonal matrices drawn at random. The strip beneath the bars is those two hundred draws, whose best is 2.7435; the polar factor is to the left of all of them, which is the minimisation being checked rather than assumed.how far is it from A to an orthogonal matrix?smaller is nearer · the polar factor minimises this in every unitarily invariant normpolar factor U2.5188QR, signs fixed2.8670QR as returned3.1329200 drawn at randomκ = 10000polar factor2.5QR, signs fixed2.9QR as returned3.1best of 200 random2.7‖A − QR‖ is the same either wayand ‖A − Q‖ is not
Fig. 2 The same comparison on a badly stretched matrix. Every candidate has moved further away and the ordering has not changed, which is what the minimisation guarantees.

The measurement, including the two hundred controls

The strip beneath the bars is two hundred randomly drawn orthogonal matrices, and it is there because nearest is a claim about all of them.

κ(A) polar QR, signs fixed best of 200 random
1.05 0.0809 0.0889 3.111
1.5 0.5864 0.6576 3.239
5 1.5668 1.8329 2.919
50 2.2063 2.4961 2.698
1000 2.4442 2.6747 2.662

The polar factor is nearer at every conditioning, by between 9 and 17 per cent. That is a real gap and it is a small one, and it would not on its own be worth an essay.

Loss of orthogonality against condition number, in binary32A log–log plot of the norm of Q-transpose-Q minus the identity against condition number. Classical Gram–Schmidt rises steeply, modified Gram–Schmidt rises gently, and Householder is flat.110²10⁴10⁶10⁸10¹⁰10¹²10⁻¹⁷10⁻¹⁴10⁻¹¹10⁻⁸10⁻⁵10⁻²10¹condition number κ(A)‖QᵀQ − I‖classicalmodifiedHouseholderκ²uκu8×8, eight seeds per κ, binary32all three reconstruct A
Fig. 3 Orthogonality as a number rather than an adjective, which is the site’s oldest measurement and the one this whole comparison is denominated in.

The gap that is not small

Permute the columns of A and ask the same question again.

polar(AP)  =  polar(A) P     to 2.3·10⁻¹⁵
QR:   ‖Q₁P − Q₂‖_F  =  3.10,   on matrices whose own norm is 2.83

QR’s answer to orthogonalise this depends on the order the columns were written in, and the polar factor’s does not. The two QR answers are not perturbations of each other; they are unrelated matrices, differing by more than their own size.

Reversing the columns of a 6×6 matrix: what each orthogonalisation returnsBoth grids print the entries of Q₁P − Q₂, where Q₁ orthogonalises A and Q₂ orthogonalises A with its columns reversed. If the answer permuted with the columns, both grids would be zero. The polar factor's is: ‖U₁P − U₂‖_F = 1.53·10⁻¹⁵. QR's is not: ‖Q₁P − Q₂‖_F = 2.353 on matrices whose own Frobenius norm is 2.449, so the two answers are essentially unrelated. Gram–Schmidt and Householder both build Q one column at a time, and the first column is treated differently from the last.polar: U₁P − U₂QR: Q₁P − Q₂0000000000000000000000000000000000000.56-0.15-0.21-0.330.06-0.64-0.430.310.310.120.20.73-0.130.64-0.031-0.0028-0.420.075-0.18-0.43-0.130.21-0.29-0.420.640.630.670.62-0.52-0.420.26-0.520.022-0.0870.2-0.24the same columns, reordered‖U₁P − U₂‖_F1.5·10⁻¹⁵‖Q₁P − Q₂‖_F2.4‖Q‖_F, for scale2.4κ of the matrix10the column space did not moveand one of the two answers did
Fig. 4 Both grids print Q₁P − Q₂, the difference between orthogonalising A and orthogonalising A with its columns reversed. The polar side is zero to fourteen digits. The QR side is not.

The reason is structural rather than numerical, and it is visible in the algorithms. Gram–Schmidt leaves the first column alone and projects the last against everything before it. Householder introduces zeros one column at a time. Both are sequential in the columns, so they treat the first one differently from the last, and permuting the columns changes which column is which.

The polar factor is defined by a minimisation over the whole matrix at once. There is no order in it to depend on.

The previous phase on this site established a test for exactly this situation: a number that moves under something the problem does not move under is a measure of the description rather than of the problem. Permuting columns does not change the column space, the singular values, or which orthogonal matrix is nearest. QR’s answer moves anyway, so QR is answering a question about the ordering.

Two condition numbers of one 8×8 system, as its rows are put into different unitsFour curves against the spread of the row units, in decades. κ_∞ of the scaled matrix rises from 9.83 to 1.9·10¹⁰ while the componentwise condition number stays at 6.98 throughout — the same system, the same solution, and one of the two numbers is a fact about the units. Hilbert's two numbers are drawn flat beside them at 3.4·10¹⁰ and 1.2·10¹⁰: a matrix whose sensitivity no scaling repairs.0246810110²10⁴10⁶10⁸10¹⁰10¹²spread of the row units (decades)condition numberκ_∞(DA)cond(DA)Hilbert κ_∞Hilbert condone system, two numbersκ_∞ at no spread9.8κ_∞ at 10 decades1.9·10¹⁰cond, either end7Hilbert, equilibrated1.3·10¹⁰the solution is the same at every spreadand one of these curves knows it
Fig. 5 The previous phase’s instance of the same test, on the condition number under a row scaling. The test is the same and the object it is applied to is different.
Classical and modified Gram–Schmidt: the same subtraction, in a different orderTwo panels of pseudocode differing in one argument, with the resulting pairwise dot products of the computed columns listed beneath each.for each previous column i, subtract the projection of column j onto qᵢclassicalr[i][j] = qᵢ · a[j] ↑ the ORIGINAL columnv = v − r[i][j] · qᵢthe three worst |qᵢ · qⱼ|:columns 7 and 8: 1columns 6 and 8: 0.13columns 6 and 7: 0.13modifiedr[i][j] = qᵢ · v ↑ what is LEFT of itv = v − r[i][j] · qᵢthe three worst |qᵢ · qⱼ|:columns 1 and 8: 4.4·10⁻⁷columns 2 and 8: 2.7·10⁻⁷columns 3 and 8: 2.4·10⁻⁸The two R factors agree to 1.2·10⁻⁶ relative. The two Q factors do not.the 8×8 Hilbert matrixone word, eight orders
Fig. 6 And the sequential structure that produces it. The order the columns are processed in is visible in what the method returns, which is exactly the property the polar factor does not have.

A sign convention worth seven times the gap

While measuring the above, something went wrong that is worth publishing rather than quietly fixing.

qrHouseholder returns an R whose diagonal entries may be negative, which negates the corresponding columns of Q. Both factorisations are perfectly valid — ‖A − QR‖/‖A‖ is 10⁻¹⁶ either way — and the convention is invisible in every quantity anybody checks.

It is not invisible in ‖A − Q‖. On the κ = 1.5 matrix, with five of eight columns flipped:

polar factor:        0.586
QR, signs fixed:     0.650
QR, as returned:     4.130
best of 200 random:  2.956

The unfixed Q is further from A than a randomly chosen orthogonal matrix. A figure drawn from it would have made QR look ridiculous, and the reason would have had nothing to do with QR.

Nothing in this fleet checks a sign convention. The factorisation is correct, the residual is at rounding, the columns are orthonormal, and every assertion the site has ever written about a QR passes. It is the same shape as the defect the last phase found in a marker’s radius: a property nobody thought to state, on an object every gate approves of.

One Householder reflection, and the sign that keeps it stableA vector, the mirror line through the origin, and its reflection landing on the negative first axis at the same distance from the origin.the mirrorx, length 4.000Hx = (-4.000, 0)v = x − αe₁safe sign: α = −‖x‖, so v is formed from a sum and nothing cancelsunsafe sign: α = +‖x‖ gives ‖v‖ only 35.1% of ‖x‖ + ‖x‖ — the digits go‖HᵀH − I‖5·10⁻¹⁶‖Hx‖ − ‖x‖8.9·10⁻¹⁶second component2.2·10⁻¹⁶built from a unit vectororthogonality is structural
Fig. 7 The reflection whose sign is at issue. A Householder step can reflect onto +‖x‖e₁ or −‖x‖e₁ and both are reflections; the choice is made for numerical reasons and it propagates into Q.
QᵀQ from classical Gram–Schmidt and from Householder on the 8×8 Hilbert matrixTwo eight-by-eight tables of QᵀQ. The upper one has ones on the diagonal and entries as large as one off it; the lower one is the identity to three decimal places everywhere.A = H8 · κ = 1.5·10¹⁰ · both factorisations reconstruct A to 6·10⁻¹⁷the diagonal is 1 in both — every column is a unit vector either way1.000000000001.000000000001.000000000001.000000000001.00000.002-0.002000001.0000.125-0.13300000.0020.1251.000-1.0000000-0.002-0.133-1.0001.000classical Gram–Schmidt1.000000000001.000000000001.000000000001.000000000001.000000000001.000000000001.000000000001.000Householderclassical ‖QᵀQ − I‖1.4Householder ‖QᵀQ − I‖1.4·10⁻¹⁵largest off-diagonal 1 against 3.1·10⁻¹⁶length is not angle
Fig. 8 And the check that passes either way. Orthogonality is a property of the columns and says nothing about which direction along each of them was chosen.

What QR is for, which is something else

None of this makes QR the wrong tool. It makes it the right tool for a different job, and the two jobs are worth separating because they are usually conflated under the word orthogonalise.

QR answers a question about a nested sequence of subspaces. Its Q has the property that the first k columns span the same space as the first k columns of A, for every k. That is a strong and useful property — it is why QR is the right factorisation for least squares, where the columns arrive in a meaningful order and the triangular R is the object being solved with — and the polar factor does not have it at all.

The polar factor answers a question about the whole matrix at once. Nearest, in every unitarily invariant norm, with no reference to any ordering. It has no triangular partner and it solves nothing.

So the rule is: if the columns mean something in order, QR; if the matrix means something as a whole, polar. A least-squares design matrix is the first case. A rotation that has drifted is the second. Confusing them is what produces an answer that changes when somebody reorders the inputs.

There is a third case worth naming, because it is the one where QR is reached for and is genuinely inadequate rather than merely different: a basis for a subspace that is going to be iterated on. Subspace iteration re-orthogonalises its basis every step, the columns have no meaningful order, and QR’s answer therefore depends on an arbitrary convention that changes as the basis rotates. Everything converges anyway, and the intermediate quantities are noisier than they need to be.

The computed angle against the true one, two formulationsTwo curves of computed angle against true angle on logarithmic axes. One follows the diagonal all the way down; the other leaves it and flattens at a fixed level.10⁻¹⁴10⁻¹²10⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²10⁻¹⁵10⁻¹³10⁻¹¹10⁻⁹10⁻⁷10⁻⁵10⁻³the true anglethe angle computed√(2u) = 1.49·10⁻⁸arcsine of ‖(I − QQᵀ)Q₂‖arccosine of σ(Q₁ᵀQ₂)two routes, one of which has a floorfloor of the arccosine route1.5·10⁻⁸√(2u)1.5·10⁻⁸worst overstatement1.5·10⁶angles returned as exactly zero3a plane tilted by a known anglethe flat part is the instrument, not the data
Fig. 9 The subspace case: the plane is well determined and its basis vectors are not, so any method that answers about the vectors is answering a question with no stable answer.
The least-squares solution as a projection, with the right angle measuredThe column space drawn edge-on as a plane, the data vector above it, and the perpendicular dropped to the plane, with the residual marked at a right angle to it.everything Ax can reachb = (1.1, 0.4, 1.5)Ax, the closest reachable pointr = b − Ax‖Aᵀr‖ / (‖A‖‖r‖)1.7·10⁻¹⁶‖b‖² − ‖Ax‖² − ‖r‖²1.3·10⁻¹⁵‖r‖1.3200 random nearby points of the plane were tried; none is closer.a 3×2 system, Householder QRperpendicularity is checked
Fig. 10 And the least-squares case, where the columns do have an order and the triangular factor is the point.

Where the answer is actually wanted

The polar factor is the answer to a question three fields ask independently and each named separately.

Orthogonal Procrustes. Given two point sets, find the rotation that best takes one onto the other: minimise ‖A − BQ‖_F over orthogonal Q. The answer is the polar factor of BᵀA. In structural biology this is the Kabsch algorithm and it aligns protein structures; in spacecraft attitude determination it is Wahba’s problem; in computer vision it is the rotation step of iterative closest point. Same formula, three names, three literatures.

Re-orthogonalising a drifted rotation. A quaternion or a rotation matrix integrated forward in time stops being orthogonal. The nearest orthogonal matrix is the right correction, and it is the one that moves the estimate least — which matters, because the correction is being applied continuously and any bias in it accumulates.

Density matrix purification and the sign function. In electronic structure calculations the idempotent projector nearest a given symmetric matrix is built from the same iteration, and the subject is the same one.

The plane, and the two vectors inside it, at a gap of 10⁻⁶A circle representing the invariant plane, with two perpendicular radii for the eigenvectors and two more for the perturbed ones, rotated within the same circle.the invariant planesolid: beforedashed: aftersame perturbation, two questionsthe vectors turned, radians0.029the plane turned, radians7.6·10⁻⁸what left the plane5.6·10⁻⁸drawn in the unperturbed plane's own basisa radius is not determined; the circle is
Fig. 11 The geometry underneath Procrustes: a subspace and the vectors in it, where the question is which orthogonal transformation carries one configuration onto another.
Smoothed aggregation against the angle of the anisotropy (ε = 0.001)Convergence factor against the rotation angle, with the stencil's largest axis coupling and its diagonal coupling on the same axis. Aligned, the factor is 0.1935. At 45° it is 0.7894, and the reason is beside it: the axis couplings are 0.5005 while the coupling along the direction the anisotropy runs in is 0.2497. The matrix does not contain the anisotropy.-213284300.250.50.751rotation of the anisotropy (degrees)factor / couplingusableconvergence factoraxis couplingdiagonal couplingthe standard answer, and the anglefactor at 0°0.19factor at 45°0.79axis ÷ diagonal coupling at 45°2the hierarchy reads the matrixand the matrix lost the direction
Fig. 12 And what happens when a rotation is corrected badly. The correction is applied every step, so a systematic error in it is integrated.

Two routes to the same U

The polar factor above is computed through an SVD, which is honest and expensive: an SVD costs more than the eigendecomposition it is often being used to avoid. It is worth checking the answer a second way before spending an essay on cheaper routes.

The second route is the SVD’s own definition run backwards. U = PQᵀ is orthogonal, so UᵀU = I, and H = UᵀA must come out symmetric positive definite — two properties neither of which was imposed. Both hold to 10⁻¹⁵ on every matrix measured here, and the symmetry of UᵀA is a genuinely independent check: nothing in the construction of PQᵀ makes QΣQᵀ symmetric except the algebra being right.

A third route exists and is the subject of the next essay: iterate. The interesting thing about the iterations is that they never mention Σ, P or Q at all, so where they agree with PQᵀ the agreement is between two computations with almost nothing in common.

Three iterations to the orthogonal polar factor, κ = 10^1Newton's iteration, X ← (X + X⁻ᵀ)/2, halves its error per step while it is far away and only becomes quadratic near the end: it is at 1.9·10⁻⁶ after six steps. Higham's scaling costs two norms and no extra factorisation and reaches thirteen digits in 5. Newton–Schulz, X ← X(3I − XᵀX)/2, uses no inverse at all — two matrix products a step and nothing that reads an entry — and needs 11 steps to get to the same place.1471013161910⁻¹⁶10⁻¹³10⁻¹⁰10⁻⁷10⁻⁴10⁻¹steprelative error in the orthogonal factorNewtonNewton, scaledNewton–Schulzone fixed point, three costsscaled Newton, steps5Newton–Schulz, steps11Newton at step 61.9·10⁻⁶scaled Newton at step 67.5·10⁻¹⁶a Newton step needs an inverseand a Schulz step needs two products
Fig. 13 The third route, on a nearly orthogonal matrix — where it converges in three steps, because it is already almost at its fixed point.

The residual, printed

The site’s rule applies here as everywhere: no decomposition drawn without its residual. For the polar decomposition there are two.

‖UᵀU − I‖_F      the orthogonality of the factor
‖A − UH‖_F/‖A‖   the reconstruction

Both are at 10⁻¹⁵ throughout the measurements above. That matters because the polar factor is computed here through an SVD, and an SVD is an expensive thing to insist on — the next essay is entirely about two ways of getting U without one, and the residuals are how those two ways are held to the same standard as this one.

Three iterations to the orthogonal polar factor, κ = 10^4Newton's iteration, X ← (X + X⁻ᵀ)/2, halves its error per step while it is far away and only becomes quadratic near the end: it is at 57 after six steps. Higham's scaling costs two norms and no extra factorisation and reaches thirteen digits in 7. Newton–Schulz, X ← X(3I − XᵀX)/2, uses no inverse at all — two matrix products a step and nothing that reads an entry — and needs 28 steps to get to the same place.159131721252910⁻¹⁶10⁻¹³10⁻¹⁰10⁻⁷10⁻⁴10⁻¹steprelative error in the orthogonal factorNewtonNewton, scaledNewton–Schulzone fixed point, three costsscaled Newton, steps7Newton–Schulz, steps28Newton at step 657scaled Newton at step 64.4·10⁻¹³a Newton step needs an inverseand a Schulz step needs two products
Fig. 14 The two iterations, which is where the next essay starts: Newton, Newton with a scaling, and one that uses no inverse at all.
σ ↦ σ(3 − σ²)/2, the map Newton–Schulz applies to every singular value, started at 1.6The cubic and the diagonal, with the iteration from 1.6 drawn as a cobweb. The fixed points are 0, 1 and −1, and zero is repelling — its slope there is 3/2. Every starting value in (0, √3) is carried to 1, so the matrix iteration converges exactly when every singular value is inside that interval; √3 = 1.7320508 is sent to exactly zero, and past it the sequence leaves. From 1.6 the limit is 1.000000.the whole convergence theory of an n×n iteration is this cubic√3start 1.610−1fixed points 0, 1, −1start1.6after one step0.35limit1the boundary, √31.7outside the basin it still convergesto an orthogonal matrix that is not the answer
Fig. 15 And the cubic that decides where the inverse-free one converges — which turns out to be a sharper boundary than anything else in this phase.

What H is, which nobody asks about

The polar decomposition has a second factor and it is usually thrown away. It should not be, because it is the more interpretable of the two.

H = QΣQᵀ is symmetric positive semidefinite with exactly the singular values of A as its eigenvalues. So A = UH says: a linear map is a stretch along orthogonal axes, followed by a rotation. That is the geometric statement the singular value decomposition is usually explained with, and the polar form says it with two objects instead of three.

In continuum mechanics the same decomposition of the deformation gradient is the right stretch tensor and the rotation, and separating them is what makes a material law frame-indifferent — the stress must depend on H and not on U, because U is where the observer’s choice of orientation went. An entire field’s constitutive theory rests on the factorisation this essay is about, reached independently and for a reason that has nothing to do with numerical analysis: U carries the part of the map that a change of observer changes, and H carries the part that it does not.

That is the same invariance argument as the column-permutation one above, and it is worth noticing that it comes from mechanics rather than from computation. A quantity that moves under something the physics does not move under cannot be in a material law; a quantity that moves under something the question does not move under cannot be the answer to it.

Error of the best rank-k approximation to a 12×12 matrixApproximation error against k on a logarithmic axis, with the measured error and the next singular value drawn as separate curves lying exactly on top of one another.123456789101110⁻¹⁰10⁻⁸10⁻⁶10⁻⁴10⁻²1rank k of the approximation‖A − Aₖ‖measured, 2-normσₖ₊₁, from theorymeasured, Frobeniusthe first two agreeto 2·10⁻⁸worst |‖A−Aₖ‖₂ − σₖ₊₁| / σₖ₊₁2·10⁻⁸worst Frobenius discrepancy2·10⁻⁸κ = 10⁹; 30 random rank-3 matrices, none closerthe error is σₖ₊₁
Fig. 16 The singular values, which are H’s eigenvalues. The polar decomposition is the same information with the rotation separated from the stretch.

Rotations, reflections, and the constraint nobody states

There is a constraint the minimisation above does not carry and most applications need, and it is the source of a well-known bug.

The orthogonal matrices come in two components: det = +1, the rotations, and det = −1, the reflections. The polar factor minimises ‖A − Q‖ over all of them, so on a data set that has been reflected — by a sign convention, a left-handed coordinate frame, or noise on a nearly degenerate configuration — it returns the reflection, which is the correct answer to the question asked and the wrong answer to the question meant. A molecular structure comes back mirrored; a robot’s estimated attitude flips.

The repair is in every implementation of the Kabsch algorithm and is worth writing out because it is not obvious that it is optimal. Compute the SVD of BᵀA = PΣQᵀ, and if det(PQᵀ) < 0, replace it by P·diag(1, …, 1, −1)·Qᵀ — that is, flip the sign of the singular vector belonging to the smallest singular value. The result is the nearest matrix with determinant +1, and the reason it is the smallest one to flip is the same argument as the original minimisation: the cost of flipping the kth direction is proportional to σ_k, so flipping the cheapest is optimal.

That is a genuinely satisfying result and it is also a warning. The unconstrained answer and the constrained one differ by a reflection, which is not a small perturbation of anything. A code that uses the polar factor for a rotation and does not check the determinant is correct on every input where the data is not nearly degenerate, and catastrophically wrong on the ones where it is — which is the shape of every intermittent bug in this fleet.

And the determinant makes an appearance the phase’s first essay would not have predicted: it is the right test here because the input is orthogonal, so its determinant is exactly ±1 and the comparison is against zero with no threshold in it. The scalar this phase opened by arguing against is the correct diagnostic on the one class of matrices where it carries no units at all.

Smoothed aggregation against the angle of the anisotropy (ε = 0.001)Convergence factor against the rotation angle, with the stencil's largest axis coupling and its diagonal coupling on the same axis. Aligned, the factor is 0.1935. At 45° it is 0.7894, and the reason is beside it: the axis couplings are 0.5005 while the coupling along the direction the anisotropy runs in is 0.2497. The matrix does not contain the anisotropy.-213284300.250.50.751rotation of the anisotropy (degrees)factor / couplingusableconvergence factoraxis couplingdiagonal couplingthe standard answer, and the anglefactor at 0°0.19factor at 45°0.79axis ÷ diagonal coupling at 45°2the hierarchy reads the matrixand the matrix lost the direction
Fig. 17 What a wrongly signed correction does when it is applied every step. The reflection is not a small error and it does not average out.

What is worth carrying

QR does not answer the question it is usually reached for. The nearest orthogonal matrix is the polar factor, nearer by 9 to 17 per cent — and the percentage is not the reason to use it.

The reason is that the answer does not depend on the column order. polar(AP) = polar(A)P to fourteen digits; QR’s answer under the same permutation is a different matrix by more than its own size. If a question does not care about the order of the columns, an answer that does is answering a different question.

And a sign convention is worth seven times the gap it hides. The raw Householder Q is further from A than a random orthogonal matrix, both factorisations reconstruct A perfectly, and no assertion on this site would have caught it.

The next essay computes the same U without an SVD, twice, and finds that one of the two methods converges to an orthogonal matrix that is not the answer and says nothing about it: an iteration that only multiplies.

What links here

Computed from the collection, not written here: the essays that point at this one.

Reads more easily once this is understood

Essays that name this one as worth reading first.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Gram–SchmidtHouseholderInvarianceOrthogonalityPolar decompositionQR factorisationRotationSVD