# Conjugate Gradient

Originally Conjugate Gradient method was developed for solving certain systems of linear equations

where is a known vector, is unknown and is a square, symmetric, positive-definite matrix. Solving this equation is equivalent to finding minimum of a corresponding square function

This method is very similar to Gradient Descent in the sense that from the initial point we choose a vector which will take us to the next point, where the objective function will decrease. The above is repeated until we reach function minimum, i.e. gradient becomes zero.

Unlike Gradient Descent the direction is not set to , is chosen such that the next direction is conjugate to with respect to Hessian matrix.

A few approaches exist for calculating . The most popular one are ones by Polak-Ribiere(1) and Fletcher-Reeves(2)

So the algorithm looks like this:

- Initialize to a random value
- Initialize direction
- Perform a line search:
- Move to the next point:
- Calculate gradient in next point:
- Calculate new direction:
- If is not small enough go to 3

Line search on step 3 can be replaced with an explicit solution, in cases where we can calculate Hessian matrix of our objective function. In this case we will get

### References

- Hestenes, Magnus R.; Stiefel, Eduard (December, 1952). "Methods of Conjugate Gradients for Solving Linear Systems". Journal of Research of the National Bureau of Standards 49 (6).