Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Find a function where $f(1)=2$, $f(2)= 4$, $f(3)= 6$ and $f(4)= \pi$.

I got $\dfrac16(x-3)(x-2)(x-1)\pi$ as a start to get rid of $\pi$.

share|improve this question
10  
Do you know about Lagrange interpolation? –  Git Gud Mar 29 at 18:40
    
How is $$\frac16(1-3)(1-2)(1-1)\pi = 2$$? –  Sabyasachi Mar 29 at 18:42
    
@GitGud I think it is quite powerful to discover Langrange interpolation. And the question here is on the brink - so don't look it up, work it out. What do you have to do to deal with $3$ the way you dealt with $\pi$? –  Mark Bennet Mar 29 at 18:43
2  
@Sabyasachi The key thing is that the expression in the question is zero for $x=1,2,3$ and $\pi$ when $x=4$ - that is a very good start. How to find something which is zero when $x=1,3,\pi$ and $4$ when $x=2$ is another question. Then how to put the pieces together, then realise you have discovered Lagrange interpolation - and understand it. –  Mark Bennet Mar 29 at 18:47
    
@MarkBennet (+1)I understand that. I was just pointing OP that he can cleverly deal with the rest like he deals with the $\pi$ –  Sabyasachi Mar 29 at 18:51

4 Answers 4

Layout: (As hinted by Mark Bennet in the comments).

Find a polynomial $P_1$ such that $P_1(1)=2$ and $P_1(2)=P_1(3)=P_1(4)=0$.

Find a polynomial $P_2$ such that $P_2(2)=4$ and $P_2(1)=P_2(3)=P_2(4)=0$.

Find a polynomial $P_3$ such that $P_3(3)=6$ and $P_3(1)=P_3(2)=P_3(4)=0$.

Find a polynomial $P_4$ such that $P_4(4)=\pi$ and $P_4(1)=P_4(2)=P_4(3)=0$.

The polynomial $P_1+P_2+P_3+P_4$ as the desired property.

You already found $P_4$, the rest should follow easily.


Alternatively, take the ansatz $P(x)=\alpha x^3+\beta x^2+\gamma x+\delta$.

You get $\begin{cases} \alpha +\beta +\gamma +\delta &=2\\ 8\alpha +4\beta +2\gamma+\delta &=4\\ 27\alpha +9\beta +3\gamma +\delta &=6\\ 64\alpha +16\beta +4\gamma +\delta &=\pi\end{cases}$ and you can solve a system, if you're patient enough.

share|improve this answer
1  
Remainder Factor Theorem works much better in this case. –  Calvin Lin Mar 29 at 19:31

[I'm assuming by function you mean cubic polynomial, otherwise this is simple.]

Observe that the first three equations are satisfied by the function $2x$.

Hence, the polynomial $f(x) - 2x$ has roots $x=1, 2, 3$, or that $f(x) = 2x + A(x-1)(x-2)(x-3)$.

Finally, set $x=4$, we get $\pi = 8 + A\times 3\times 2 \times 1$, or that $ A = \frac{\pi-8}{6}$. Hence,

$$f(x) = 2x + \frac{\pi - 8} {6} ( x-1)(x-2)(x-3).$$


Lagrange Interpolation would be the general method to approach problems like this. This solution exploits a property from the selected values.

share|improve this answer
1  
Nicest solution, with simplest result. –  Ruslan Mar 29 at 19:44
    
Nice.${{{{}}}}$ –  Git Gud Mar 29 at 20:29

Your way of dealing with $\pi$ is very smart, but apparently you only took it because $\pi$ is irrational, and you are expecting to get the "nicer" values of $2,4,6$ in different ways. Here's something you can do, use seperate terms that are zero at $1,2,\pi$ and $6$ at $3$. Try it for yourself. Add all the terms. You already have the requisite insight.

$$\frac{(x-3)(x-2)(x-1)\pi}{6}+\frac{(x-\pi)(x-1)(x-2)6}{2(3-\pi)}+\frac{(x-\pi)(x-1)(x-3)4}{(2-\pi)\times-1}\\+\frac{(x-2)(x-3)(x-\pi)2}{(-1)(-2)(1-\pi)}$$

Simplyfying,

$$\frac{(x-3)(x-2)(x-1)\pi}{6}+\frac{3(x-\pi)(x-1)(x-2)}{(3-\pi)}+\frac{4(x-\pi)(x-1)(x-3)}{(\pi-2)}+\\\frac{(x-2)(x-3)(x-\pi)2}{2(1-\pi)}$$

share|improve this answer
    
@seaturtles fair enough. –  Sabyasachi Mar 29 at 18:51

The Lagrange Interpolation method that Git Gud mentions is a way to find a polynomial that goes through a specified (finite) set of points. Suppose we want a polynomial function $p(x)$ such that $p(x_1)=y_1, p(x_2)=y_2, \ldots, p(x_n)=y_n$, where each $x_i$ is distinct from the others.

Then the following polynomial fulfills the conditions:

$$\sum_{i=1}^n{y_i\frac{(x_1-x)(x_2-x)\cdots (x_{i-1}-x)(x_{i+1}-x)\cdots (x_n-x)}{(x_1-x_i)(x_2-x_i)\cdots (x_{i-1}-x_i)(x_{i+1}-x_i)\cdots (x_n-x_i)}}$$

The idea is that we want to create a polynomial $p_i$ that is equal to 1 when evaluated at $x_i$, but zero when evaluated at the other $x_j$ values. Thus, our desired polynomial would then just be $\sum_{i=1}^n{y_ip_i(x)}$. The polynomial $\frac{(x_1-x)(x_2-x)\cdots (x_{i-1}-x)(x_{i+1}-x)\cdots (x_n-x)}{(x_1-x_i)(x_2-x_i)\cdots (x_{i-1}-x_i)(x_{i+1}-x_i)\cdots (x_n-x_i)}$ is precisely such a $p_i$.

Try using this method to create the polynomial: you've already figured out one of the terms in the sum, so just finish it off!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.