4

I'm doing a project in MATLAB where I need to do dimensionality reduction and reconstruction using PCA. This is going fine however I noticed that when trying to reconstruct an image using all eigenvectors the reconstruction error (I use RMSE) is not equal to zero. Which I think it should be if I understand PCA correctly. Visually I don't see any difference between the original and the reconstruction of the image, but the RMSE between the two has a value of 4.5538e-16.

So my question now is why is this not zero? Has this to do with some rounding errors in MATLAB or am I doing something wrong or misunderstanding something?

donjon
  • 41
  • 1

1 Answers1

6

It's rounding errors.

Floating point arithmetic (IEEE 754) is not exact. In double-precision, errors on the order of $10^{-16}$ are effectively zero.

Some related discussion, in the context of p-values reported in R, can be found in How should tiny $p$-values be reported? (and why does R put a minimum on 2.22e-16?)

Sycorax
  • 76,417
  • 20
  • 189
  • 313