# Behavior of PCA, Eigen, SVD (and other SVD)

Hi.

In a development I'm doing I need an SVD for a 2x2 matrix. This matrix is created from the gradients of the image, (inside a window).

SUM - sum of values

```
SUM(dx*dx) , SUM(dx*dy) ;
SUM(dx*dy) , SUM(dy*dy)
```

the thing is that I tried with OpenCV functions SVD, Eigen; and a specific and simple SVD method for a 2x2 matriz (lets call it svd22).

also with PCA, with an Nx2 matrix with the N gradients dx and dy inside the window. if I have not seen wrong de opencv code, PCA builds this same matrix, or something like that, by mean M * M´, as it should be.

all deliver the same eigenvectors (but 2 diferent sign) and one (PCA) diferent eigenvalues

```
e-values [2x1]
e-vectors [2x2]
```

the problem is:

the values in positions 0,1 and 1,0 of the matrix of e-vectors, PCA and Eigen deliver eigenvectors with opposite sign to SVD and the function svd22. I mean, for example:

where PCA and Eigen give

```
1,2
-2,1
```

SVD and svd2x2 give

```
1,-2
2,1
```

the other difference is that PCA e-values are much smaller than those that deliver the other three functions

Is this the behavior of PCA, Eigen and SVD?

What does that sign change mean?

Why does PCA deliver smaller e-values?