# 3d linear regression line equations

I have a bunch of points in 3D space (around to a survey line). Since only half of the point coordinates were measured, I want to compute a linear regression, from which I extrapolate the other points (based on their distance to the known points). The result should be a line. As far as I understand, numerically the starting system would be:

$$\begin{bmatrix}z_1 \\ \vdots \\ z_n \end{bmatrix} = \begin{bmatrix} 1 & x_1 & y_1 \\ \vdots & \vdots & \vdots \\ 1 & x_n & y_n \end{bmatrix} \begin{bmatrix} a_0 \\ a_1 \\ a_2 \end{bmatrix}$$

which would end up giving me a linear equation of the form

$$z = a_o + a_1x+ a_2y$$

However what I need in order for convenience would be the vector form of the line equation, so that

$$\begin{pmatrix} x \\ y \\ z\end{pmatrix} = \begin{pmatrix} x_0 \\ y_0 \\ z_0 \end{pmatrix} + d\begin{pmatrix} a \\ b \\ c\end{pmatrix}$$

Am I just missing the obvious solution of turning the first line equation into the latter, or is it possible to do this with the numeric regression in the first place?

• You have two predictors, right? If so, you will be fitting a plane of best fit (the $z = a_0 + a_1 x + a_2 y$), so you won't get a line. If you know the equation of the plane $z = a_0 + a_1 x + a_2 y$, then if you remember your introductory linear algebra, you should know how to convert this to parametric vector form (there will be two direction vectors rather than just one). – Minus One-Twelfth Mar 16 at 20:13