· 36 min read

Form Follows Function(al): Improving a Matrix Algorithm


On this page

A quick ramble preamble on why I’m writing this post

TL;DR - I noticed a really cool connection between a pure math class and a CS class I was taking, and I wanted to write about it.

The vitriol I hear against maths from high schoolers frequently uses words like mechanical or dull. In higher education, that narrative seems to flip almost entirely—pure maths can be appreciated for its elegance and beauty, but it is rarely seen as a practically useful subject1. Indeed, if forced to consider job prospects that actually use the subject material2, one could be forgiven for lumping pure maths with literature and philosophy. It is the latter of these two criticisms that annoys me more. And it’s not because I don’t enjoy the beauty of mathematics (I absolutely do!). It’s because for one, I think pure maths builds an incredibly robust way of thinking3, one that rewards making progress across any point on a spectrum4. A conjecture is not yielding a proof? Restrict to special cases and retry. A useful tool doesn’t apply to your situation? Generalize the tool, or reframe your setup and keep trying.

But more importantly, remarkable people find ways to make ideas from pure maths useful to real-world problems all the time (and wrapping up my rant, this brings us to the actual topic of my blog post). In the spring semester of sophomore year, I took two classes straddling opposite ends of the applied-pure divide. Randomised Algorithms was motivated purely from problems in data science and Functional Analysis5 was, on its own, one of the most abstract classes I’ve taken. At some point in Randomised Algorithms, we studied an optimisation for a textbook matrix algorithm, and one of the pieces of that proof cited a special family of functions as a black box. Now, I really dislike rabbit-out-of-hat steps in problem-solving. And, through sheer serendipity, we studied that same family of functions in Functional Analysis that very week6. So, somewhat indignantly, I dove into how and why these ideas intersect, and I think the upshot of it really brings out my favourite parts of maths. That is (which my brilliantly witty title gets at), maths where the problem-solving structure follows directly from the motivating questions—form follows function7. Now, I’m going to share it with you.

A note before you continue

I direct your attention first to this rather brilliant comic. I am sure the many people working in niche research fields, who are oft asked to explain what they do to their friends and family, will relate to this.

A four-panel comic. An excited man tells a woman he will use science to blow her mind, asking whether she knows it is thought impossible to factor very large numbers quickly on a classical computer. She flatly answers no. He tries again with simulating protein folding; she does not know that either. He concludes he would need six weeks to build up her classical intuition, only for her to find out her intuition is totally wrong.
“This is why it’s hard to explain quantum computing.” — Saturday Morning Breakfast Cereal, by Zach Weinersmith.

A lot of what makes this blog post interesting is that it takes a very standard textbook algorithm and makes a clever observation about something wasteful that could be put to better use. So, I beseech you bear with me while I:

  1. Convince you of the importance of the thing we’re computing in the first place,
  2. Establish the textbook algorithm and its runtime,
  3. Identify the wastefulness of a specific choice in that algorithm,
  4. Show you how we can optimally use those wasted resources,

and perhaps then you will share my excitement in how pure maths has totally changed our intuition.

For the sake of brevity, I do assume a fair working background in linear algebra and probability. Some introductory analysis would be helpful too.

Introduction

The problem in which we are interested is computing the top- singular values and vectors of a matrix. Modern quantitative data very often comes in the form of matrices—rows and rows of data and a column for each measurable quantity. Linear algebra tells us that we can study a lot of the underlying structure of matrices through their eigenvector-eigenvalue pairs, but eigenvectors only exist for square matrices, and even then there’s no guarantee they will exist over the reals. Singular values (SVs) are the fix. Every matrix, square or not, admits a singular value decomposition , where the columns of (right singular vectors) form an orthonormal basis, and maps that basis to an orthogonal set of directions (left singular vectors), stretched by the nonnegative singular values sitting along the diagonal of .

Because we can represent any (correctly-sized) vector as a linear combination of this basis, and sitting right there in the matrix are the scaling factors we apply to each component, we realize that the dominant structural directions in our data are the singular vectors with largest singular value. More precisely, if we choose some cutoff rank , then we are interested in the top singular values and vectors: . This is the fundamental mechanism underpinning many modern data science techniques, like PCA, LoRA, KV-cache, etc.

Now, we could always compute the whole singular value decomposition (SVD), and then pick the top . The textbook way to do this is to make the matrix square by computing its Gram matrix and then computing its eigendecomposition, which turns out to be enough to pick off the singular values8. But for problems with massive datasets9, this would be extraordinarily wasteful. Specifically, for rows and columns, this takes time. The first method to avoid the full SVD is an algorithm called the Power Method, which computes only the top singular value10.


Problem Statememt

For a matrix , without loss of generality assume , and let the SVD of be

For the matrix multiplication version (center),

For the outer product version (right), for 11.

We assume the usual properties of the SVD: the matrices and have orthonormal columns, and is diagonal.

Problem: compute the top right-singular vector and value of strictly faster than the SVD algorithm. That is, compute and in time .


The Power Method

This outline is largely adapted from the fantastic notes from Prof. Teal Witter’s Randomized Algorithms class; all credit belongs to him.12

Algorithm

The first step is still to compute the Gram matrix. which takes time .

Because is symmetric, it has real, non-negative eigenvalues and orthonormal eigenvectors . Notice that the eigenvectors of are exactly the right singular vectors of , and its eigenvalues are the squared singular values ().

  1. Choose randomly. E.g. .13
  2. For
  3. Return

In short, we repeat a two-step process times: multiply our vector by , and then normalize it. Our final product is a unit vector equal to , where is just a scaling factor .14


The important parameter

Now that we have it in this form with ‘s, we must acknolwedge that our final analysis will be a guarantee based on the spectral gap parameter , which captures how dominant the top SV was in the dataset to begin with.

Specfically, we define

or more intuitively, “by what percentage must we reduce the most dominant SV, to get to the second-largest SV”.

(Intuitively, if is close to , the top SV is already dominant and it will be easy to isolate it. If is tiny, then there’s a close battle for the top SV, so it’s tough to isolate the correct one)


Analysis of the Power Method

Full Analysis

I highly recommend reading through the full analysis to understand the machinery. However, if you choose not to, the important outcomes are the following:

  • We can set our error tolerance as needed, and then choose our number of iterations . Our answer is guaranteed to be -close to the top right-singular vector
  • Specifically, the minimum iterations needed is
  • Notice that the dependence of our required iterations is only logarithmic in . This is very weak! We can dramatically tighten our error tolerance, and require only a modest number of extra iterations

First, by definition of and recalling the defined SVD of ,

where . The second equality follows from applying the transpose and noting is diagonal thus symmetric; the third equality follows from orthonormal columns of by definition; the fourth equality follows from being diagonal and our definition of .

So,

where the second equality follows from orthonormal rows of by definition; and the third equality from being diagonal thus commuting in the outer-product version of matrix multiplication.

Recall our final answer:

We need some more useful way to represent . Luckily, because the eigenvectors of form a complete basis of , we can represent as a linear combination in it. Specifically,

where the coefficients are given by the inner product .

So,

where the third equality follows from the fact that , so cross-terms in the expansion disappear.

Going back, recall that our goal is to show that our algorithm gets very close to the actual largest singular vector . In particular, we will show that the contribution from any singular vector that’s not is arbitrarily small.

First, to separate out the error, we divide through by ‘s coefficient, or . So,

where the third equality followed by simply observing that the coefficients cancel for and starting the summation from

The way we chose , with independent standard Gaussian coordinates, makes it rotationally invariant.15 Therefore, the distribution of for , is , which tells us we can assume w.h.p.16 that

Next, using our parameter

And we can apply the standard bound from the Taylor series of to claim

Thus, if we conveniently17 choose , we get

and since we showed above that , we get that

w.h.p.


Next, given that based on our choice of , we claim:

For all , either or .18

Proof.

Recall from the steps of our algorithm that was normalized, i.e. a unit-vector. So, in the orthonormal basis of , none of its components could have magnitude greater than . So, the first coefficient . Therefore starting from our previous result,

Again using the unit-vector property, the sum of squared coefficients must be . That is,

But,

So, and therefore so too is

For any unit vector , we have . Since , we conclude that either or .

Suppose without loss of generality it’s the first: . Then we would conclude that:

Thus, we conclude our proof that with only logarithmic dependence on our tolerance and dimension , the power method returns a good approximation for top right-singular vector.


As we saw above, the big influence is . We would be remarkably lucky if the data’s structure were represented by just one dominant vector direction, but often even highly structured data has a handful of important directions. Then, the gap from the first to second could be tiny, and would shoot up dramatically and ruin our runtime. The Lanczos method, which we will now see, brings this dependence down dramatically to .


The Lanczos Method

The first important observation of this method requires us to scrutinize what we actually computed during the Power Method. In particular, the most efficient way for us to get to our final product was to do matrix-vector computations, computing each for

In doing so, we actually computed all the pieces of what we call a Krylov Subspace, which by definition is any subspace generated by starting with a single vector and repeatedly multiplying by a fixed matrix .

The Power Method clearly just returned a scaling of the last column. The whole idea behind Lanczos is to avoid “throwing away” information from earlier columns like the power method, but instead to take advantage of the whole space which we had to generate anyway.

Specifically, to define the Lanczos method, we will let be a matrix with orthonormal columns that spans our Krylov subspace. In practice, we do not compute the Krylov matrix directly and then orthonormalize it, as this is numerically unstable. Instead, because our target matrix is symmetric, we can build the columns of iteratively using a highly efficient “three-term recurrence.”

Algorithm

  • Initialize a random starting vector .
  • Compute an orthonormal basis for the degree Krylov subspace spanned by .
  • Form the matrix . (Because is symmetric, will be a tridiagonal matrix, making it very cheap to store and manipulate).
  • Let be the top eigenvector of .
  • Return .
A note on time complexity

Importantly, the step to build only requires matrix-vector multiplications with , each of which can be implemented in time (if , we multiply by then ). The step to find might look a bit circular at first glance. We want an approximation algorithm for computing the top eigenvector of , and the above method uses a top eigenvector algorithm as a subroutine. But note that only has size , where is our iteration count. So even if it’s too expensive to compute a direct eigendecomposition of , the eigendecomposition of the small tridiagonal matrix can be computed in just time.


Analysis of the Lanczos Method

The heart of the analysis here is 2 claims:

  1. The Lanczos Method returns a vector that is arbitrarily close to the best approximate eigenvector in the Krylov subspace.
  2. There always exists some vector in the Krylov subspace that is significantly better than what the Power Method returns

If we can prove these two things, it will immediately follow that the Lanczos Method does significantly better than the Power Method.


Claim 1 (Lanczos almost-optimality). Let be the vector returned by the Lanczos method, and let be any unit vector in the span of the Krylov subspace. If either or , then either or .

In other words, while the Lanczos output does not exactly minimize the mean-squared error to over the Krylov subspace, it comes within a factor of the minimum. As we will see below, with the correct setup, this is all we need.

Proof of Claim 1

First, for any unit vector , we have , so the hypothesis is equivalent to .

Expanding in the eigenvector basis, the first coefficient is , and since all eigenvalues are non-negative we can drop every term but the first:

Next, observe that the Lanczos output maximizes the quadratic form over all unit vectors in the span of the Krylov subspace.

To see this, we substitute into the quadratic form:

By the definition of eigenvectors, the unit vector that maximizes this quadratic form is exactly the top eigenvectors of the matrix .19

Recall from our algorithm definition that we explicitly defined to be the top eigenvector of . Therefore, the that maximizes our objective is exactly . Thus, the optimal vector in the subspace is .

Therefore,

Now, expanding in the basis of ,

Since every eigenvalue with is at most :

Rearranging gives , and dividing through by :

Since both values lie in , it follows that . Because , suppose without loss of generality20 . Then,


Claim 2 (Existence of better vector). If we run the Lanczos method for iterations, there is some vector of the form such that

We delay the proof-work of this claim21, and first show that proving this claim suffices to beat the power method.

First, again without loss of generality, given , we assume . Recalling that and are unit vectors, we know and so,

Suppose we invoke Claim 2 with the smaller accuracy parameter . Then the subspace contains a vector with error at most , and Claim 1, applied with , guarantees the Lanczos output satisfies:

exactly matching the guarantee we proved for the Power Method. The cost of shrinking the accuracy parameter is only logarithmic (negligible), and the iteration count becomes

compared to for the Power Method. So, we get quadratic improvement: versus the original .22


An Approximation Theory Question

What remains for us to now do is prove Claim 2, and here enters approximation theory (an area built on functional analysis).

Notice that any vector in the Krylov subspace

is just a linear combination of the basis vectors with some coefficients, as follows:

Equivalently, this is just a degree- polynomial in . So, our problem reduces to finding the best polynomial such that is a good approximation to .23

The next crucial thing to notice is that the polynomial function moves cleanly into our eigendecomposition. In particular, we saw above that for a degree- monomial, , so if we factor sums of monomials, we get

The Power Method chose a very basic polynomial: . This does scale the largest eigenvalue more than the others, but we claim that if we use the lower degree terms, we can do much better.

As an aside, this is where the Randomized Algorithm class jumped to the final result. My goal is to progress to a solution constructively, based on intuitive ideas.


To start building intuition for which degree- polynomial we want to use, it’s strangely helpful to relax the polynomial condition, or relax the degree- condition.

  1. If we were allowed to pick any arbitrary function , the answer would be trivial: have and for all . Then, .
  2. If we were allowed to pick a polynomial with degree at least , then again we could have roots, and send the non-dominant ‘s to . But usually we compute a subspace of size .
Graph of an ideal filter function: flat at 0 across lambda_d through lambda_2, then ramping up to 1 at lambda_1.
The idealized (non-polynomial) filter: , for .
Graph of an oscillating degree d-1 polynomial with roots at lambda_d through lambda_2, normalized to 1 at lambda_1.
A degree- polynomial filter with roots at .

Unfortunately, we are restricted to degree- polynomials. If we try to approximate Graph 2, we might have uncovered roots where we’re far from 0, as seen in the local extrema of the graph. Instead, the safer bet seems to be finding the best degree- polynomial approximation of Graph 1, where we try to minimise our maximum distance from on .

Functional analysis helps us confirm these exact two intuitions.

For notational convenience, we define to be our normalized initial vector .

Definition 1. Let the spectral measure be defined as

where the delta function is defined

Note that the is not standard. It’s a choice we make because we’re only minimizing over the range and not on

Ignoring the excessive notation I have just introduced, the idea is fairly straightforward. The spectral measure is a function tied to our matrix and initial vector . It always returns the quadratic form of the initial vector with respect to , but it restricts its attention to the eigenvectors of which happen to be in . can be any set of real numbers24.

Definition 2. Let the function norm be defined such that

This notation is designed to be extremely general for function spaces. But, we know that our spectrum of ‘s is discrete. So, the will only assign non-zero weight at the ‘s and we can convert this to a sum. Secondly, we know we’re only applying this to polynomials , not general .

Hopefully this is already looking familiar. It’s helpful to observe that is passing in the singleton set to our definiton of , so the will collapse the sum to the single term . So,

where the last term is in the usual vector norm, and is exactly the quantity our Lanczos method is trying to minimize! However, as we saw from our definitions, the function measure will depend on the spectrum of ; if we exactly knew the spectrum of we would already be done. But since can be anything, there are adversarial worst-cases.

To be more precise about the problem, the norm is expressive of the structure of the spectrum. If you choose to go about some minimization process of , you’re committing to a minimization based on that structure. Then, whatever guarantee you get stops holding as soon as changes because the spectrum changes. This explains why approximating Graph 2 would not work: No matter what we choose, there could exist some whose was bad for us.

We bent over backwards setting up things in the language of functional analysis above, precisely because it unlocks standard result from functional analysis for us! In particular, for any norms of functions for 25:

Note: we use because we know our spectrum lies there and it makes analysis easier

The key thing to notice here is, only once we reach the limit do we have uniform norm over the interval . So,

  1. There are no more adversarial worst cases. Minimizing with this measure applies over the whole range .
  2. By the monotonicity property shown above, whatever bound we find on will apply to our goal of bounding

So, our new goal is to find whose absolute value is minimal on the interval . That is, which most closely approximates , which explains why approximating Graph 1 is the correct choice!

Of course, the degree- approximation literally exists. So we restrict our domain to


Now we’re in a good place, with a well-defined problem. Find the best degree- polynomial such that and is minimized on

To begin with, a good intuition for how to use our degrees is as follows. Suppose we want to minimise the maximum absolute value the function achieves on the interval to some upper bound . Then, we should let our polynomial curve in that direction till it hits , and use our next degree to bend it back in the opposite direction trying to keep it in the ribbon.

degree-4 p
M=0.1-M=-0.1λ8λ7λ6λ5λ4λ3λ2λ10λp(λ)
Drag the slider: as k grows, more roots are spent on bending the curve back and forth around the x -axis, so the ripple tracks the ±M band over a longer stretch and more closely, before shooting up/down and the end.

It turns out this intuition is almost perfect. Approximation theory formalizes this idea with the Equioscillation Theorem.

First, define

Theorem 3 (Equioscillation Theorem). A polynomial of degree minimizes constrained to for if and only if there exist points at which attains its maximum absolute value with alternating signs, i.e.

where or determines the sign of the first extremum.

Proof of the Equioscillation Theorem

Forward direction. Suppose is optimal. We will show that it must equioscillate.

Suppose, for contradiction, does not equioscillate. We will show that some other polynomial is better, contradicting optimality.

Order the extremal points and look at the sign sequence of on them. Since full alternation with points fails, there are at most alternating points, and therefore at most sign alternations among extremal points for some . So, we can partition into non-empty subintervals (separated by cut points chosen in the gaps between the last extremal point of one sign and the first of the next) so that within each all extremal points share one sign, and these signs alternate from block to block.

Using the cut points of this partition, we will construct a correction polynomial. Define

where again, or just allows us to flip sign, so is a polynomial of degree . Since is constructed to have roots at exactly the cut points of the intervals , it has constant alternating sign on each block , just like . Choose so that agrees with on all intervals. Then, everywhere on . This fact will help our analysis of the correction.

Now, we perturb by some small amount to show an improvement. Consider the improved function

We would have just used , but we need to preserve the original constraint that . So, is just modified so that .

For completeness, we do this by defining where is a suitable polynomial. We can define . Really can be any root between and times , just so that has opposite sign structure to on but then the same sign at , so is positive. Then, looking back at the definition of , we know that shares sign with , so retains its sign from on and . We added a degree to , but we were at so it’s safe now to go to .

So now, is valid candidate, and we show that it’s an improvement. Consider .

Remember from above that . So, for small enough , we get . Therefore, on the whole interval, including extreme points, . So their absolute value has shrunk at the extreme points and was not optimal, thus a contradiction.

So, if is optimal, it must equioscillate.


Backward direction. Suppose equioscillates at points with alternating signs and norm . We will show that it must be optimal.

Let be any other feasible polynomial with . Consider the difference

At each , with alternating sign, and , so,

has the same sign as or is zero. So takes values that alternate in sign (weakly) across the points .

A weak sign alternation across points forces to have at least zeros in (counting a sign change or a shared zero in each of the consecutive gaps; strict alternation gives genuine roots, and the degenerate cases where only add roots). Together with the constraint zero at a point outside , distinct from those zeros, so has at least zeros. But is a difference of two polynomials of degree at most and so can have at most roots. Therefore,

So, not only does equioscillation guarantee is optimal, it proves that the solution is unique.


We have proved the Equioscillation Theorem for and a fixed point . It is clear to see that the polynomial can be affinely transformed to any interval, and any fixed point and still hold the same guarantees. We can use an affine change of variables to make the same claim for on constrained to .

So, we know we need a polynomial that equioscillates times. The natural next question is how do we define this function.

If I have seen further, it is by standing on the shoulders of giants,
— Isaac Newton

We turn to the best, most classic equioscillator we know: the cosine function. In fact, the cosine function was screaming the answer at us all along. If we go back to the Taylor series definition of cosine we get

It literally uses each successive degree of its polynomial with alternate sign to stay perfectly inside , and converges to the cosine at . We, however, are restricted to finite degrees. So what cosine-like polynomial do we choose?

Well, we haven’t extracted all our mileage out of the Equioscillation Theorem yet. It gave us two pieces of information.

  1. Value information: At the alternation points ,
  2. Derivative information: at the alternation points, is achieving its maximum or minimum, so, if it’s interior in then . Crucially, we know how many such points there are but not where they are. Any successful argument must somehow not need their locations.

Observe that has degree , but there are extremal points which were candidates to form the roots of . So two of the extremal points were not interior, forcing them to be on the boundaries and ; we can multiply those in ourselves. And, squaring the part, we get with roots exactly at the equioscillation points.

Now consider . This will have roots exactly where and because has at exactly distinct points where it hits , will have roots. The interior points will have multiplicity 2 and the boundaries will have multiplicity 1. So will have roots exactly at the equioscillation points.

Lastly, it is well-established that polynomials are uniquely determined by their roots, upto a constant multiplier. We have shown that both these polynomials have equal degree and have roots exactly at the equioscillation points. So they must be equal up to a constant , giving us the ODE:

Finally, solving this differential equation using standard techniques (out of scope here) reveals that the solution must be:

It can be easily verified by using the useful substitution of on or outside that this exactly matches the Chebyshev polynomials of the first kind26

Notably, on the range we get

exactly as we were trying to do before! And this confirms that our equioscillation is from

So, we have finally proved constructively that the Chebyshev polynomials are the optimal choice for this setting. Specifcally, arbitrarily letting equal they are defined by the recurrence

and it achieves equioscillation at magnitude .


As a last step, in our original formulation, we wanted to construct using the inverse question: “If I have spectral gap , what degree do I need to suppress down to ?”

Let be the affine transform and take the scaled Chebyshev filter

note that the denominator is a constant.

By construction and since and we know on . So,

Everything now hinges on how large is. By rearranging the definition, observe that , using our spectral gap parameter .

We know for that

and we know by definitions of cosh and arccosh that

For , we get . And using the Taylor series of , we get that . Or equivalently, . Putting this together we get,

So, to achieve , we need

Lastly, notice that we have more ‘s, and in the worst case, they might all be aribtrarily close to . Therefore, if we wanted to suppress the sum of all of them to be less than , we would need a new on the order . Plugging this in, we finally match our bound from Claim 2

and we are done.


degree-3 Chebyshev filter p
minimum m = 3max |p| ≈ 0.0101p1)/max |p| ≈ 99
0λ2= 1λ1= 2p(λ1)= 1max|p|= 0.0101λp(λ)
The scaled Chebyshev filter with λ2 = 1 and λ1 = 1/(1−γ). Solve for the smallest degree m that pins the ripple under ε, or choose m yourself and watch the ripple shrink — shrinking the spectral gap γ drives the required degree up like 1/√γ.

Recap

To sum up, the steps we took to improve the Lanczos Method’s improvement over the Power Method were:

  1. We proved that the Lanczos Method’s response gets arbitrarily close to whatever optimal response there may have been in the Krylov Subspace
  2. We claimed that there existed at least some vector in the Krylov Subspace that was much better than the Power Method’s response (and thus the Lanczos method gets arbitrarily close to that improvement).
  3. We showed that all vectors in the Krylov subspace were generated by a polynomial function.
  4. We set up a relevant minimax problem over the space of constrained polynomials where we wanted to be fixed to and then the remaining ‘s shurnk as small as possible.
  5. We proved that regardless of which specific polynomial was best, it must equioscillate
  6. Finally, we proved that if it equioscillated, then it must be the Chebyshev polynomial (affinely transformed)

Footnotes

  1. Of course, applied maths, as the name suggests, does not fall under this category of criticism. But then again, if your maths isn’t primarily proof-based… is it really maths?

  2. (1) Educator in the subject. (2) Academic who writes for other academics in the subject

  3. In fact I had to word my previous comment kind of carefully, because it seems maths majors are increasingly hired for this kind of thinking and exposure to rigor.

  4. This statement should actually be quite funny after you read the whole article.

  5. For any CS or maths major who has the chance to study at the Claremont Colleges, these were MATH126 and MATH138 respectively. 10/10, would recommend.

  6. To paraphrase Dr. Doofenshmirtz, “If I had a nickel for every time the exact same concept came up in two different college classes on the same day, I’d have three nickels—which isn’t a lot, but it’s weird that it happened thrice, right?”.
    For reference, the other two (and a half?) times are: (1) Markov’s inequality in MATH157 Probability and MATH137 Measure Theory; (2) Bellman-Ford in CS140 Algorithms and MATH187 Operations Research as LP-duality; (2.5?) Lagrange Multipliers again in MATH187, and in Multivariable Calc which I was TAing.

  7. Or here, functional analysis. I fear I may have ruined the joke by explaining it.

  8. For a matrix , the Gram matrix is . It turns out that this matrix is guaranteed to be square and symmetric, which is sufficient for it to have a complete orthonormal eigendecomposition (a thing we love!)

  9. which is practically all problems today

  10. It also turns out that computing just the top singular value is enough, because we can “slice” (or more accurately “project”) off that top singular value, and then repeat the method to get the new top (formerly second-largest) singular value, and continue times.

  11. here is notation for the integer indexing set .

  12. I try to gloss over some of the intricacies here, so I recommend reading the notes for a more thorough treatment.

  13. Interestingly, this initial vector is the only place where randomness enters our algorithm. The Gaussian choice is convenient for analysis, but really any random choice works because it makes adversarial worst cases extremely unlikely.

  14. While yes, the value of does depend on the matrix and the initial vector, the important thing is it does not change the direction of vectors at any stage, so we preserve the thing we actually care about—the direction pf the largest right-singular vector.

  15. That is, changing to a different orthonormal basis, like we did here , does nothing to the distribution of the coordinates.

  16. with high probability. This convention in randomized algorithms says that a condition becomes vanishingly improbable. Here, for even a modest size of like , we get a guarantee.

  17. the choice of here may seem arbitrary, but the “convenience” here is slotting it nicely into our analysis later

  18. Intuitively, we can choose a threshold to be as small as we need, and be guaranteed that either is -close to , or it’s -close to . Notice that they’re both good enough because we can take our singular value to be .

  19. The intuitive way to see this is to imagine you have a budget of 1 because we’re restricted to unit vectors, and you have to distribute that budget over the eigenvectors to maximize the total size. You know by definition that eigenvector gets the biggest multiplier , so the maximizing choice to put all your budget on and none anywhere else.

  20. The proof follows almost identically for

  21. Because that’s the real fun part of this blog post!

  22. For reference, with , the power method needs on the order of passes over the data per factor of , while Lanczos needs on the order of .

  23. If you’ve taken a course in Real Analysis, this may have pricked up your ears, because the Stone-Weierstrass Theorem tells us we can approximate any function arbitrarily well with polynomials. So, this may seem like a very natural/intuitive position to be in.

  24. Technically, we’ve defined as taking only Borel sets, but distinction is not relevant; those cover all non-pathological sets we might actually need to use.

  25. Technically, this comes from Hölder’s inequality and relies on the spectral measure being no more than on the space, but that is a given from our normalization of

  26. Chebyshev Polynomials