# Lagrange polynomial in 3-D. Variable of interest is a vector.

I have familiarity with lagrange interpolation polynomials in 1-D for a scalar variable of interest. I am currently interested in a 3-D interpolation of a variable that is a vector $\vec{u} = [u, v, w]$.

So essentially, I think what I need is 3 separate polynomials, one for each scalar of vector $\vec{u}$. But I am unsure how to generate a multi-variate lagrange polynomial. Any suggestions?

• Do you mean a "polynomial" which returns vector values? Or a function with vector arguments which returns real numbers, and which is a polynomial in each of the coordinates of the vector? Jan 15, 2017 at 21:57
• Thanks. It should be the latter. Essentially each component of vector $\vec{u}$ is hypothesized to be affected by the 3 dimensions (x,y,z). So I think I would need 3 equations, each of which is a f(x,y,z), that would return u, v, w, components of the vector $\vec{u}$. Does that make sense? I have no idea how to write a multi-variate lagrange polynomial. I've only had experience with the basic 1-D lagrange polys.. Jan 15, 2017 at 23:01
• There isn't a natural generalization of Lagrange interpolation to multiple dimensions, unless your points $(x,y,z)$ lie on a regular grid. For the general case, look up multivariate interpolation.
– user856
Jan 16, 2017 at 0:34

So let's assume you have a set of data for the unknown model of $\vec{u}$, namely $\mathcal{D} = \lbrace (x_i,y_i,z_i,\vec{u}_i) \rbrace_{i=1}^{n}$. We can then approximate the model using Lagrange Interpolation in the following way:

\begin{align} \vec{u}(x,y,z) \approx \sum_{i=1}^{n} \vec{u}_i \mathcal{L}_{i}(x,y,z) \end{align}

where $\mathcal{L}_i(\cdot)$ represents the $i^{th}$ Lagrange Polynomial and $\mathcal{L}_{i}(x_j,y_j,z_j) = \delta_{i,j}$ where $\delta_{ij}$ is the Kronecker Delta. We can then define the $i^{th}$ Lagrange Polynomial to be the following such that the Kronecker Delta property is satisfied:

\begin{align} \mathcal{L}_{i}(x,y,z) = \prod_{k=1,k \neq i}^{n} \frac{\left(x - x_{k}\right)\left(y - y_{k}\right)\left(z - z_{k}\right)}{\left(x_i - x_{k}\right)\left(y_i - y_{k}\right)\left(z_i - z_{k}\right)} \end{align}

The above formulation should allow you to tackle your problem. Note, as written in the comments, that multidimensional Lagrange Interpolation isn't the safest approach as it can be badly behaved if any of the components of the data are close to each other. This is a negative property of Lagrange Interpolation in general, even in 1D, that risks happening more often when dealing with datasets in higher dimensions.

For higher dimensional interpolation, it would be better to use a different approach.

• This becomes very badly behaved when two points have $x_i\approx x_k$, even if the points themselves are well separated in $\mathbb R^3$. In the limit $x_i=x_k$ the formula is undefined.
– user856
Jan 16, 2017 at 0:31
• @Rahul This is correct. This would happen for any Lagrange Interpolation scheme, though, even in 1D. While I have this formula written based on the question, I don't state it as the best approach to interpolating higher dimensional data. Jan 16, 2017 at 0:48
• The difference is that for 1D the problem only arises if the data points are extremely close together, in which case any interpolation scheme will have trouble. For higher dimensions, the scheme in your answer has problems even if the points are well separated.
– user856
Jan 16, 2017 at 0:55
• @Rahul You are correct, the points can be well separated in $\mathbb{R}^3$ and still have the problem, but that's because of the same issue that exists in 1D. We can view $\mathcal{L}_{i}(x,y,z)$ as products of 1D Lagrange Polynomials for each dimension, e.g. $\mathcal{L}_{i}(x,y,z) = \mathcal{L}_{i}^{x}(x) \mathcal{L}_{i}^{y}(y) \mathcal{L}_{i}^{z}(z)$, and thus we can see that if any of the individual Lagrange Polynomial is badly behaved, the net Lagrange Polynomial is badly behaved. But if the data does not produce a badly behaved polynomial, then it can work fine. Jan 16, 2017 at 1:05
• @Rahul I will add that I don't think Lagrange Interpolation is the approach to use for this type of problem, but the OP did ask about how one could approach their problem using Lagrange Interpolation. Maybe I will just add that this can be poorly behaved, as you mentioned. Jan 16, 2017 at 1:06