A linear autoencoder with a k-dimensional bottleneck, encoder W1∈Rk×d and decoder W2∈Rd×k, is trained with squared reconstruction error on centred data. How does its solution relate to PCA, and what changes with a nonlinear autoencoder?

Unsupervised learning, Dimensionality reduction
Level L4 Advanced. Length Medium. Nature Th+Mat Both.

What's being asked

Whether you can use the best low-rank approximation result to show that a linear autoencoder learns the same subspace as PCA, and say what it does not learn.

Key idea

The autoencoder maps x to a code W1x and back to W2W1x. The matrix W2W1 has rank at most k, and by the Eckart–Young theorem the best rank-k approximation of the data, in squared error, is the projection onto the top k principal directions. So at the optimum W2W1=VkVk⊤, where Vk holds the top k principal directions as columns: the same subspace as PCA, but W1 is fixed only up to an invertible k×k matrix.

Steps

  1. Write the loss over all centred samples (rows of Xc): ∥Xc−XcW1⊤W2⊤∥F2, where ∥⋅∥F2 is the sum of squared entries. Note that W2W1 has rank at most k, because it passes through k numbers.
  2. Apply Eckart–Young: among all rank-k matrices, the truncated SVD UkSkVk⊤ is closest to Xc, and it equals XcVkVk⊤. So the loss is minimised when W2W1=VkVk⊤. Baldi and Hornik (1989) showed this is the global minimum and the other stationary points are saddles, so gradient descent can find it.
  3. Show the non-uniqueness. For any invertible k×k matrix A, the pair (W2A−1,AW1) gives the same product W2W1 and so the same reconstruction. The code spans the PCA subspace, but its axes need not be orthogonal or ordered by variance.
  4. Say how to recover the actual principal directions: orthonormalise the columns of W2 and run PCA on the k-dimensional codes. Tied weights W2=W1⊤ with orthonormal rows are not enough on their own: any rotation of the rows gives the same loss, so they give an orthonormal basis of the subspace, not the ordered directions.
  5. Nonlinear autoencoder: a nonlinear encoder and decoder can follow curved surfaces in the data (for example a spiral) that would need many linear components. The price is a non-convex loss, harder training, and a result that is not unique or as easy to interpret as PCA.

Common mistakes

How long your answer should be

Half a page; 4–5 minutes.

Last checked on 4 December 2026.

Read this

Previous in Unsupervised learning: How can the principal components in a feature space ϕ(x) be found by solving an eigenvalue problem for the n×n kernel matrix K, with Kij=k(xi,xj)=ϕ(xi)⊤ϕ(xj)? How are the coefficients normalised, how is K centred, and how is a new point projected?
Next in Unsupervised learning: For a similarity graph with symmetric non-negative weights W and degree matrix D, let L=D−W. How do you prove that f⊤Lf=12∑i,jwij(fi−fj)2, how does this show that the number of zero eigenvalues of L equals the number of connected components, and why does this justify spectral clustering?