Atomic structure of N-electron atoms is often determined using the Hartree-Fock method, which is an integro-differential equation. The exchange term of the Hartree-Fock equations is usually treated as an inhomogeneous term of a differential equation, or with a local density approximation. This work uses matrix methods to solve for the Hartree-Fock equations, rather than the more commonly-used shooting method to integrate an inhomogeneous differential equation. It is well known that a derivative operator can be expressed as a matrix made of finite-difference coefficients; energy eigenvalues and eigenvectors can be obtained by using computer linear-algebra packages. We extend the same technique to integro-differential equations, where a discretized integral can be written as a sum in matrix form. This method is compared against experiment and standard atomic structure calculations. We also can use this method for free-electron wavefunctions. This technique is important for spectral line broadening in two ways: improving the atomic structure calculations, and improving the motion of the plasma electrons that collide with the atom.