orthogonality of eigenfunctions
Orthogonality is what makes a basis useful. If your building blocks are mutually perpendicular, you can read off how much of each is in a given function independently, the way you read off x, y, z coordinates of a vector without solving a system. For a Sturm-Liouville problem, eigenfunctions belonging to different eigenvalues are automatically orthogonal — with respect to the weight w — and that single fact is what turns a generalized Fourier expansion from a hard linear-algebra problem into a list of simple integrals.
Here is the mechanism in words. Take two eigenfunctions y_m, y_n with eigenvalues lambda_m not equal to lambda_n. Each satisfies the self-adjoint equation. Multiply the m-equation by y_n, the n-equation by y_m, subtract, and integrate over [a, b]. The derivative terms combine into a total derivative of the boundary expression p (y_m' y_n - y_m y_n'), which integrates to a boundary term that the boundary conditions kill. What is left is (lambda_m - lambda_n) times integral of y_m y_n w dx equals zero. Since the eigenvalues differ, the integral must vanish: integral from a to b of y_m(x) y_n(x) w(x) dx = 0. The weight w is not optional — it is exactly the coefficient that the equation hands you.
This orthogonality is the workhorse of applied eigenfunction methods. To find the coefficient c_n in an expansion f = sum of c_n y_n, you project: multiply by y_n w and integrate, and every other term drops out, leaving c_n = (integral of f y_n w dx) / (integral of y_n^2 w dx). It is the same move as a Fourier coefficient, now for Legendre, Bessel, Hermite, or any Sturm-Liouville basis. Without orthogonality you would have to invert an infinite coupled system instead.
Legendre polynomials satisfy integral from -1 to 1 of P_m(x) P_n(x) dx = 0 for m not equal to n (weight w = 1). So to expand f(x) = x^2 on [-1, 1] you just compute the projections onto P_0, P_1, P_2 and find x^2 = (1/3) P_0 + (2/3) P_2 — no solving of equations.
Orthogonality turns coefficient-finding into independent integrals, one per mode.
Different eigenvalues guarantee orthogonality; if one eigenvalue has several independent eigenfunctions (a degeneracy, common with periodic conditions), those are not automatically orthogonal and you must orthogonalize them by hand with Gram-Schmidt.