0

Find the quadratic polynomial $p(x)$ for given data points $$p(x_0)=y_0, p'(x_1)=y_1', p(x_2)=y_2 \text{ with } x_0 \neq x_2.$$

My approach

I tried the problem taking $p(x)=a+bx+c x^2$ but I am not sure about.

Any help is appreciated.

2 Answers2

1

The most general quadratic that goes through $(x_0,y_0)$ and $(x_2,y_2)$ is $$p(x)=y_0+\frac{(y_2-y_0)}{(x_2-x_0)}(x-x_0)+C(x-x_0)(x_2-x)$$ Then we require $$p^{\prime}(x_1)=y_1^{\prime}=\frac{(y_2-y_0)}{(x_2-x_0)}+C(x_0+x_2-2x_1)$$ If $x_0+x_2-2x_1=0$ there may be no solution. Otherwise solve for $C$ and your solution is as given.

user5713492
  • 15,938
  • How are you getting a factor $C (x-x_0)(x_2-x)$? – Atul Anurag Sharma Feb 24 '20 at 01:33
  • Let $$q(x)=p(x)-y_0-\frac{(y_2-y_0)}{(x_2-x_0)}(x-x_0)$$ Then $q(x_0)=q(x_2)=0$ so it's a quadratic polynomial with zeros at $x=x_0$ and $x=x_2$, thus has factors $(x-x_0)$ and $(x-x_2)$. Since its degree is at most $2$ it is just a constant times the product of these factors: $q(x)=C(x-x_0)(x_2-x)$. – user5713492 Feb 24 '20 at 01:49
  • Is there any way to write $p(x)$ in terms of Lagrange coefficients? – Atul Anurag Sharma Feb 24 '20 at 01:51
  • It's Hermite interpolation, not collocation. You can write out pieces like $$L_0(x)=\frac{(x-2x_1+x_2)(x_2-x)}{(x_0-2x_1+x_2)(x_2-x_0)}$$ that satisfies the conditions that $L_0(x_0)=1$, $L_0^{\prime}(x_1)=L_0(x_2)=0$ and $$L_1(x)=\frac{(x-x_0)(x_2-x)}{x_0-2x_1+x_2}$$ where $L_1^{\prime}(x_1)=1$ and $L_1(x_0)=L_1(x_2)=0$ which has the flavor of Lagrange coefficients but is not the same, in particular they aren't defined for $x_0-2x_1+x_2=0$. – user5713492 Feb 24 '20 at 02:16
  • is the above polynomial unique? – Atul Anurag Sharma Feb 24 '20 at 17:33
  • If $x_1/ne\frac{x_0+x_2}2$ then you get a unique solution, otherwise there is either no solution or infinitely many solutions. – user5713492 Feb 24 '20 at 19:13
0

Starting with a generic quadratic polynomial, you could create three linear equations. $$p(x)=a+bx+cx^2$$ $$p'(x)=b+2cx$$ Then $$\begin{cases}y_0=a+bx_0+cx_0^2\\y_1'=b+2cx_1\\y_2=a+bx_2+cx_2^2\end{cases}$$ Finally, solve for $a$, $b$ and $c$.