One of the essential steps in the processing of a vertical seismic profile is the separation of upgoing and downgoing signals. With this perspective in mind, seismic data recorded in a borehole are modeled in terms of these waves and a mathematically optimal 'least-squares' technique for extracting them is derived. The method imposes practically no constraints on the spacing between recording levels and allows almost perfect rejection of a coherent downgoing signal.The exact formulation of the one-dimensional model requires that acoustic impedance information be included, but a reasonable and realistic approximation can neglect impedance. We derive frequency-wavenumber response plots for the two limiting cases of even and randomly spaced levels and compare these to the response of a 'conventional' velocity filtering technique. By a careful study of available logs, recording levels can be chosen to optimize geophone coupling rather than insisting on uniform spatial sampling. Data editing, normalization, and true amplitude recovery (TAR) are required prior to application of the technique. The TAR correction can be computed from sonic log data, which emphasizes the possibility of more complete synergism between the seismic and logging worlds.