We describe and test a method for recovering the three-dimensional potential, velocity, and density fields from large-scale redshift-distance samples. Galaxies are taken as tracers of the velocity field - not of the mass. We first obtain a smooth radial velocity field by averaging the radial peculiar velocities of galaxies using a tensor window function. Our smoothing procedure addresses measurement errors, Poisson noise, and nonuniform spatial sampling. To reconstruct the three-dimensional velocity field from its radial component we make the key assumption that the smoothed velocity field is a potential flow, as might be expected from perturbations that grew by gravity. The density field and the initial conditions are calculated using an iterative procedure that applies the no-vorticity assumption at an initial time and uses the Zel'dovich approximation to relate initial and final positions of particles on a grid. The method is tested using a cosmological N-body simulation "observed" at the positions of real galaxies in a redshift-distance sample, taking into account their distance measurement errors. Malmquist bias and other systematic and statistical errors are extensively explored using both analytical techniques and Monte Carlo simulations. First applications to the real universe are described in an associated paper.