DIIS

DIIS (direct inversion in the iterative subspace or direct inversion of the iterative subspace), also known as Pulay mixing, is a technique for extrapolating the solution to a set of linear equations by directly minimizing an error residual (e.g. a Newton–Raphson step size) with respect to a linear combination of known sample vectors. DIIS was developed by Peter Pulay in the field of computational quantum chemistry with the intent to accelerate and stabilize the convergence of the Hartree–Fock self-consistent field method.
At a given iteration, the approach constructs a linear combination of approximate error vectors from previous iterations. The coefficients of the linear combination are determined so to best approximate, in a least squares sense, the null vector. The newly determined coefficients are then used to extrapolate the function variable for the next iteration. 
Details.
At each iteration, an approximate error vector, , corresponding to the variable value, is determined. After sufficient iterations, a linear combination of previous error vectors is constructed
The DIIS method seeks to minimize the norm of under the constraint that the coefficients sum to one. The reason why the coefficients must sum to one can be seen if we write the trial vector as the sum of the exact solution () and an error vector. In the DIIS approximation, we get:
We minimize the second term while it is clear that the sum coefficients must be equal to one if we want to find the exact solution.
The minimization is done by a Lagrange multiplier technique. Introducing an undetermined multiplier , a Lagrangian is constructed as
Equating zero to the derivatives of with respect to the coefficients and the multiplier leads to a system of linear equations to be solved for the coefficients (and the Lagrange multiplier). 
Moving the minus sign to , results in an equivalent symmetric problem.
The coefficients are then used to update the variable as