Given a set of points $(x_i, u_i), \; i = 1, \dots, n$ (for my application $n = 5$) one can construct an interpolating polynomial $$ P(x) = \sum_{i=1}^n u_i \ell_i(x), \quad \operatorname{deg} P = n - 1. $$ Let's consider the big stencil $S = \{x_1, x_2, \dots, x_n\}$ and the small (partial) stencil $S_i = \{x_i, x_{i+1}, \dots, x_{i+p}\}$ of $p+1$ consecutive points. On each of those partial stencils one can also build an interpolating polynomial of degree $p$. Let's denote them by $ P_i(x), \; \operatorname{deg} P_i = p. $
It seems that $P(x)$ is expressible in terms of $P_i(x)$ and weighting functions $\gamma(x)$, depending only on $x_i$: $$ P(x) = \sum_{i = 1}^{n - p} \gamma_i(x) P_i(x). $$
For example, given the set of points $\left\{(-2, u_{-2}), (-1, u_{-1}), (0, u_0), (1, u_1), (2, u_2)\right\}$ $$ P_1(x) = \frac{1}{2} u_{-2} x (x+1)-u_{-1} x (x+2)+\frac{1}{2} u_0 (x+1) (x+2)\\ P_2(x) = u_0 \left(1-x^2\right)+\frac{1}{2} u_{-1} (x-1) x+\frac{1}{2} u_1 x (x+1)\\ P_3(x) = \frac{1}{2} u_0 (x-1)(x-2)-u_1 (x-2) x+\frac{1}{2} u_2 (x-1) x $$ corresponding weights are $$ \gamma_1(x) = \frac{(x-2)(x-1)}{12}\\ \gamma_2(x) = \frac{4-x^2}{6}\\ \gamma_3(x) = \frac{(x+2)(x+1)}{12}. $$ From now I've found the weights by solving a linear system, but I'm looking for a more intelligent way of finding the weighting polynomials.