# User:Jarle Pahr/SVD

### From OpenWetWare

Notes on Singular Value Decomposition (SVD):

See also http://en.wikipedia.org/wiki/Singular_value_decomposition

Eigenvectors and eigenvalues:

An eigenvector of a matrix is A is a non-zero vector that satisfies the equation

Where λ is a scalar. λ is called an eigenvalue.

Any *m**x**n* matrix A can be factored as:

where:

*U*is an mXm orthogonal matrix where the columns are the eigenvectors of*A**A*^{T}*V*is an nXn orthogonal matrix where the columns are the eigenvectors of*A*^{T}*A*- is an mXn diagonal matrix where the
*r*first diagona elements are the square roots of the eigenvalues of*A*^{T}*A*, also called the singular values of A. Singular values are always real and positive.

For any SVD, the following facts apply:

- The rank of a matrix A equals the number of singular values of A.
- The column space of A is spanned by the first r columns of U.
- The null space of A is spanned by the last n − r columns of V.
- The row space of A is spanned by the first r columns of V.
- The null space of AT is spanned by the last m − r columns of U.

The columns of *U* are called the *left singular vectors*, and the columns of *V* the*right singular vectors*.

## Contents |

# SVD in NumPy

http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.svd.html

To find the rank of a matrix A, assign u,s,vh = linalg.svd(A) and r = len(s)

# Applications to metabolic networks

Given a metabolic network with stoichoimetric matrix *S*, the change in metabolite concentrations *x* as function of the reaction rates *v* is given by the equation:

The singular value decomposition of S is

Which can be written as:

The above expression defines a series of independent equations on the form

*S**v*_{k} = σ_{k}*u*_{k}

Where *v*_{k} are the column vectors of V (the right singular vectors), σ_{k} are the singular valus and *u*_{k} are the column vectors of U (the left singular vectors).

Applying the SVD to S, we get:

The columns of U, called the *left singular vectors* and denoted *U*_{i} form linear combinations of the concentations variables. Similarly, columns of V, called the *right singular vectors'* and denoted *V*_{i} form linear combinations of the fluxes. Linear combinations of concentration variablesare called *pools* while linear combinations of fluxes are called *pathways*.

For each nonzero singular value σ_{k} there is a corresponding column *u*_{k} in U and a row whose relationship is described by the equation

where the linar combination of metabolite concentrations

is being driven by the linear combination of metabolic fluxes

Each column *u*_{k} of U thus defines an *eigen-reaction* or *systemic metabolic reaction* which can be expressed as

The elements of *u*_{k} are called *systemeic stoichiometric coefficients* and the elements of *v*_{k} are called *systemeic participation numbers*.

Attention: The right singular vectors *v*_{k} should not be confused with the flux vector *v*.

# Links

http://www.uwlax.edu/faculty/will/svd/

math.stackexchange.com/questions/261801/how-can-you-explain-the-singular-value-decomposition-to-non-specialists

http://www.ams.org/samplings/feature-column/fcarc-svd

http://campar.in.tum.de/twiki/pub/Chair/TeachingWs05ComputerVision/3DCV_svd_000.pdf

http://langvillea.people.cofc.edu/DISSECTION-LAB/Emmie%27sLSI-SVDModule/p4module.html

## Finding the null space of a matrix

Finding null space of matrix: http://www.math.odu.edu/~bogacki/cgi-bin/lat.cgi

https://github.com/amilsted/evoMPS/blob/master/evoMPS/nullspace.py

http://wiki.scipy.org/Cookbook/RankNullspace

A rational basis for the nullspace of a matrix with rational elements can be found using SymPy.

# Examples

A SVD of N is

If N is a stoichiometric matrix, we find for the first eigenreaction:

A larger example is given below, using the stoichiometric matrix of the example metabolic network from Navid & Almaas 2012:

# Links

Simple SVD calculator: http://metamerist.com/excanvas/example23a.htm

http://www.dotnumerics.com/MatrixCalculator/default.aspx

# Bibliography

Palsson, 2006. Systems Biology: Properties of reconstructed networks. Cambridge.

Famili & Palsson. Journal of theoretical biology 224 (2003) 87-96.