The Anderson localization problem in one and two dimensions is solved analytically via the calculation of the generalized Lyapunov exponents. This is achieved by making use of signal theory. The phase diagram can be analyzed in this way. In the one dimensional case all states are localized for arbitrarily small disorder in agreement with existing theories. In the two dimensional case for larger energies and large disorder all states are localized but for certain energies and small disorder extended and localized states coexist. The phase of delocalized states is marginally stable. We demonstrate that the metal-insulator transition should be interpreted as a first-order phase transition. Consequences for perturbation approaches, the problem of self-averaging quantities and numerical scaling are discussed.