Algorithm Search⌘K

Proofs: Kaczmarz method

These are the human proofs of Kaczmarz method, at full length.

Cost of the Kaczmarz method full

This proof shows: time.expected, space.extra, steps.expected, flops.per_sweep.

AA is stored by rows (CSR) with zz nonzeros, ziz_i in row ii, so ∑izi=z\sum_i z_i = z.

Setup (line L1). The squared row norms cost 2z2 z flops, and for the randomized order their cumulative sums mm more additions. O(z+m)O(z + m) time and mm words.

Flops per sweep. In a row step, bi−aiTxb_i - a_i^T x costs ziz_i multiplications and ziz_i additions or subtractions, line L6 one multiplication and one division (with ∥ai∥2\|a_i\|^2 precomputed), and line L7 ziz_i multiplications and ziz_i additions. So 4zi+24 z_i + 2 flops, and 4z+2m4 z + 2 m for the mm steps of a sweep. The residual at line L8 costs 2z2 z flops for AxA x, mm subtractions, and 2m2m for the norm, so a full sweep costs 6z+O(m)6 z + O(m) flops.

Steps for accuracy ε\varepsilon. By Theorem 5 of the correctness proof, E∥ek∥2≤(1−κ−2)k∥e0∥2≤e−k/κ2∥e0∥2\mathbb{E}\|e_k\|^2 \le (1 - \kappa^{-2})^k \|e_0\|^2 \le e^{-k/\kappa^2}\|e_0\|^2, using 1−t≤e−t1 - t \le e^{-t}. So k=⌈κ2ln⁡(1/ε)⌉k = \lceil \kappa^2 \ln(1/\varepsilon) \rceil steps give E∥ek∥2≤ε∥e0∥2\mathbb{E}\|e_k\|^2 \le \varepsilon \|e_0\|^2.

Expected time. A randomized step draws one uniform number and finds the row by binary search in the cumulative sums, O(log⁡m)O(\log m), then costs O(zi+1)⊆O(n)O(z_i + 1) \subseteq O(n) for the row update. With the setup, kk steps cost O(z+m+(n+log⁡m)k)O(z + m + (n + \log m) k), which with the kk above is O(z+m+(n+log⁡m)κ2log⁡(1/ε))O(z + m + (n + \log m)\kappa^2 \log(1/\varepsilon)) (the residual test of line L8 is excluded from this count, since the bound concerns the error, not the stopping rule).

Space. The iterate takes nn words, the row norms and cumulative sums 2m2m words, and the residual mm words: Θ(m+n)\Theta(m + n) extra space besides AA and bb. ■\blacksquare

Correctness of the Kaczmarz method full

This proof shows: correctness, termination.

Exact arithmetic throughout. A∈Rm×nA \in \mathbb{R}^{m \times n} has rows aiTa_i^T, and only rows with ai≠0a_i \ne 0 are used (line L5). One step on row ii with relaxation ω\omega maps xx to x′=x+ωbi−aiTx∥ai∥2aix' = x + \omega \frac{b_i - a_i^T x}{\|a_i\|^2} a_i.

Lemma 1 (projection). For ω=1\omega = 1, aiTx′=bia_i^T x' = b_i, and x′x' is the point of the hyperplane Hi={y:aiTy=bi}H_i = \{ y : a_i^T y = b_i \} nearest to xx.

Proof. aiTx′=aiTx+(bi−aiTx)=bia_i^T x' = a_i^T x + (b_i - a_i^T x) = b_i. For any y∈Hiy \in H_i, x−x′=−bi−aiTx∥ai∥2aix - x' = -\frac{b_i - a_i^T x}{\|a_i\|^2} a_i is parallel to aia_i and x′−yx' - y is orthogonal to aia_i (both lie in HiH_i), so ∥x−y∥2=∥x−x′∥2+∥x′−y∥2≥∥x−x′∥2\|x - y\|^2 = \|x - x'\|^2 + \|x' - y\|^2 \ge \|x - x'\|^2. □\square

Theorem 2 (error identity). Let x∗x^\ast satisfy aiTx∗=bia_i^T x^\ast = b_i, e=x−x∗e = x - x^\ast, e′=x′−x∗e' = x' - x^\ast and ρ=bi−aiTx\rho = b_i - a_i^T x. Then ∥e′∥2=∥e∥2−ω(2−ω)ρ2/∥ai∥2\|e'\|^2 = \|e\|^2 - \omega(2 - \omega)\rho^2/\|a_i\|^2.

Proof. ρ=aiT(x∗−x)=−aiTe\rho = a_i^T (x^\ast - x) = -a_i^T e, and e′=e+ωρ ai/∥ai∥2e' = e + \omega \rho\, a_i / \|a_i\|^2. Expanding, ∥e′∥2=∥e∥2+2ωρ aiTe/∥ai∥2+ω2ρ2/∥ai∥2=∥e∥2−2ωρ2/∥ai∥2+ω2ρ2/∥ai∥2\|e'\|^2 = \|e\|^2 + 2\omega\rho\, a_i^T e/\|a_i\|^2 + \omega^2 \rho^2/\|a_i\|^2 = \|e\|^2 - 2\omega \rho^2/\|a_i\|^2 + \omega^2\rho^2/\|a_i\|^2. □\square

So if Ax=bA x = b is consistent and 0<ω<20 < \omega < 2, the distance to every solution is nonincreasing, and strictly decreasing whenever the chosen equation is violated.

Lemma 3 (invariant subspace). Every iterate lies in x0+range⁡(AT)x_0 + \operatorname{range}(A^T).

Proof. Each step adds a multiple of a row aia_i, which lies in range⁡(AT)\operatorname{range}(A^T). □\square

Let xˉ=A+b+(I−A+A)x0\bar x = A^+ b + (I - A^+ A) x_0. If Ax=bA x = b is consistent, xˉ\bar x is a solution, and xˉ−x0=A+(b−Ax0)∈range⁡(AT)\bar x - x_0 = A^+(b - A x_0) \in \operatorname{range}(A^T). Since range⁡(AT)⊥ker⁡A\operatorname{range}(A^T) \perp \ker A, for any solution y=xˉ+wy = \bar x + w, w∈ker⁡Aw \in \ker A, ∥y−x0∥2=∥xˉ−x0∥2+∥w∥2\|y - x_0\|^2 = \|\bar x - x_0\|^2 + \|w\|^2, so xˉ\bar x is the solution nearest x0x_0. By Lemma 3, ek=xk−xˉ∈range⁡(AT)e_k = x_k - \bar x \in \operatorname{range}(A^T) for all kk.

Theorem 4 (cyclic convergence). If Ax=bA x = b is consistent and 0<ω<20 < \omega < 2, the cyclic iterates converge to xˉ\bar x.

Proof. Write one cyclic sweep on the error as e↦Qee \mapsto Q e with Q=Pm⋯P1Q = P_m \cdots P_1, Pi=I−ωaiaiT/∥ai∥2P_i = I - \omega a_i a_i^T/\|a_i\|^2 (identity for zero rows); this holds because bi=aiTxˉb_i = a_i^T \bar x. Each PiP_i is symmetric with eigenvalues 11 (on ai⊥a_i^\perp) and 1−ω∈(−1,1)1 - \omega \in (-1, 1), so ∥Pi∥2≤1\|P_i\|_2 \le 1, and ∥Piv∥=∥v∥\|P_i v\| = \|v\| only if aiTv=0a_i^T v = 0, in which case Piv=vP_i v = v. The space S=range⁡(AT)S = \operatorname{range}(A^T) is invariant under every PiP_i. Let v∈Sv \in S with ∥Qv∥=∥v∥\|Q v\| = \|v\|. Then every factor preserves the norm, so inductively a1Tv=0a_1^T v = 0, P1v=vP_1 v = v, a2Tv=0a_2^T v = 0, and so on: v⊥aiv \perp a_i for all ii, so v∈S∩S⊥={0}v \in S \cap S^\perp = \{0\}. Hence ∥Qv∥<∥v∥\|Q v\| < \|v\| for every nonzero vv in SS, and by compactness of the unit sphere of SS, q=max⁡v∈S,∥v∥=1∥Qv∥<1q = \max_{v \in S, \|v\| = 1} \|Q v\| < 1. So ∥esweep s∥≤qs∥e0∥\|e_{\text{sweep } s}\| \le q^s \|e_0\|, and the iterates within a sweep are bounded by the norm at the start of the sweep by Theorem 2. □\square

Theorem 5 (randomized rate, Strohmer and Vershynin). Let Ax=bA x = b be consistent, ω=1\omega = 1, and let each step choose row ii independently with probability pi=∥ai∥2/∥A∥F2p_i = \|a_i\|^2/\|A\|_F^2. Then E∥xk−xˉ∥2≤(1−σmin⁡2/∥A∥F2)k∥x0−xˉ∥2\mathbb{E}\|x_k - \bar x\|^2 \le (1 - \sigma_{\min}^2/\|A\|_F^2)^k \|x_0 - \bar x\|^2, where σmin⁡\sigma_{\min} is the smallest nonzero singular value of AA.

Proof. Condition on e=eke = e_k. By Theorem 2 with ω=1\omega = 1 and ρ=−aiTe\rho = -a_i^T e, E[∥ek+1∥2∣e]=∥e∥2−∑ipi(aiTe)2/∥ai∥2=∥e∥2−∥Ae∥2/∥A∥F2\mathbb{E}[\|e_{k+1}\|^2 \mid e] = \|e\|^2 - \sum_i p_i (a_i^T e)^2/\|a_i\|^2 = \|e\|^2 - \|A e\|^2/\|A\|_F^2. Since e∈range⁡(AT)e \in \operatorname{range}(A^T), which is spanned by the right singular vectors of the nonzero singular values, ∥Ae∥2≥σmin⁡2∥e∥2\|A e\|^2 \ge \sigma_{\min}^2 \|e\|^2. So E[∥ek+1∥2∣e]≤(1−σmin⁡2/∥A∥F2)∥e∥2\mathbb{E}[\|e_{k+1}\|^2 \mid e] \le (1 - \sigma_{\min}^2/\|A\|_F^2)\|e\|^2; take expectations and induct. □\square

The factor equals 1−κ−21 - \kappa^{-2} with κ=∥A∥F/σmin⁡=∥A∥F∥A+∥2\kappa = \|A\|_F/\sigma_{\min} = \|A\|_F \|A^+\|_2, and it lies in [0,1)[0, 1) because ∥A∥F2=∑jσj2≥σmin⁡2\|A\|_F^2 = \sum_j \sigma_j^2 \ge \sigma_{\min}^2.

Termination. Line L2 runs at most maxitmaxit sweeps of mm steps each, and each step is a constant number of vector operations, so the procedure halts. It returns "converged" only when line L9 has verified ∥b−Ax∥2≤tol⋅∥b∥2\|b - A x\|_2 \le tol \cdot \|b\|_2 for the returned xx; otherwise it returns "maxit". ■\blacksquare

Back to Kaczmarz method