We have geocentric observations in RA and DEC. We want to transform those observations to heliocentric vectors given a heliocentric distance that we guess.
$ \large \vec{r}_{sb} $ is the heliocentric vector pointing from the Sun to the body we're observing. We will guess its length $ \large \lvert \vec{r}_{sb} \rvert $ and then calculate the full vector based on that guess.
$ \large \vec{r}_{so} $ is the vector that points from the Sun to the observer location and can be obtained from JPL Horizons.
$ \large \hat{r}_{ob} $ is the unit vector that points from the observer to the body being observed. $ \large \hat{r}_{ob} $ can be calculated from RA and DEC using a unit observer-body distance.
We assert the scalar $ \large \lvert \vec{r}_{sb} \rvert $ and know both $ \large \vec{r}_{so} $ and $ \large \hat{r}_{ob} $. We want to calculate the $ \large \alpha $ that scales the unit vector $ \large \hat{r}_{ob} $ to determine $ \large \vec{r}_{sb} $ for our asserted $ \large \lvert \vec{r}_{sb} \rvert $. This relation is stated in eq. 1 below.
(1)
(2)
Now expand eq. 2
(3)
Rearranging eq. 3 we can see it is a quadratic and we can solve for $ \large \alpha $
(4)
But first let's simplify eq. 4 using vector notation which also allows us to extend to 3 dimensions
(5)
Rearraging eq. 5 we get the familiar form of the quadratic equation
(6)
Eq. 6 is a quadratic of the form $ \large ax^2 + bx + c = 0 $ with the coefficients below. Note that the length of the unit vector squared $ \large \lvert \hat{r}_{ob} \rvert^2 $ is always equal to 1.
The solution to the quadratic of course yields two roots. The positive root (should there be one) is the value we want because it points in the direction our observer is looking: $ \large \hat{r}_{ob} $. Negative roots still yield an $ \large \vec{r}_{sb} $ of the correct length, but they point in the opposite direction of $ \large \hat{r}_{ob} $ which is non-physical for the observer. Knowning $ \large \alpha $ we can now solve for $ \large \vec{r}_{sb} $ using eq. 1.