We construct the path integral for determining the potential on any dendritic tree described by a linear cable equation. This is done by generalizing Brownian motion from a line to a tree. We also construct the path integral for dendritic structures with spatially-varying and/or time-dependent membrane conductivities due, for example, to synaptic inputs. The path integral allows novel computational techniques to be applied to cable problems. Our analysis leads ultimately to an exact expression for the Green's function on a dendritic tree of arbitrary geometry expressed in terms of a set of simple diagrammatic rules. These rules providing a fast and efficient method for solving complex cable problems.