Abstract. A variational problem characterizing the density estimator defined by the maximum a posteriori method with Gaussian process priors is derived. It is shown that this problem is well posed and can be solved with Newton's method. Numerically, the solution is approximated by a Galerkin/finite element method with piecewise multilinear functions on uniform grids. Error bounds for this method are given and numerical experiments are performed for one-, two-, and three-dimensional examples. Key words. density estimation, finite elements, Galerkin, Newton AMS subject classifications. Primary, 65C60; Secondary, 65K10 DOI. 10.1137/080736478