We find the potential function whose gradient best approximates an observed square integrable function on a bounded open set subject to prescribed weight factors. With an appropriate choice of topology, we show that the gradient operator is a bounded linear operator and that the desired potential function is obtained by solving a second-order, self-adjoint, linear, elliptic partial differential equation. The main result makes a precise analogy with a standard procedure for the best approximate solution of a system of linear algebraic equations. The use of bounded operators means that the definitive equation is expressed in terms of well-defined functions and that the error in a numerical solution can be calculated by direct substitution into this equation. The proposed method is illustrated with a hypothetical example.