0
$\begingroup$

How would I go about creating a polynomial $f$ such that
\begin{align*} f(x) &= A_1\\
f(y) &= A_2\\
f'(x) &= B_1\\
f'(y) &= B_2 \end{align*}
With $x$ not equal to $y$ and $A_1$, $A_2$, $B_1$, $B_2$ real numbers?

  • 1
    @ JimJones: This is just to guide you to the solution. First of all what do you think the order of the polynomial should be? Can it be linear or quadratic?2010-11-15
  • 1
    Remember that n conditions *uniquely determine* a polynomial of degree n-1. Otherwise, look up Hermite interpolation.2010-11-15
  • 0
    @JimJones: Wrong in taking $X=x^{2}$ and $Y=y$2010-11-15
  • 0
    I think I could make it linear, I'm just having trouble canceling2010-11-15
  • 0
    *Two* points determine a line. You however have *four* conditions to contend with.2010-11-15
  • 0
    So I have a 3rd degree function?2010-11-15
  • 0
    Unless your points and slopes are in some special configuration, yes.2010-11-15
  • 0
    I'm sorry, I don't see how this helps me. I don't understand how to plug in X to get A1 or B1 without actual numbers2010-11-15
  • 0
    @JimJones: Did you look up Hermite interpolation yet? In any case, a naive approach would be to write $f(x)=ax^3+bx^2+cx+d$ and write down each of your conditions as equations in the coefficients.2010-11-15
  • 0
    So I can choose A1 to be (aX^3 + bX^2 + cX + d) ?2010-11-15
  • 0
    Yes, I looked at the Hermite interpolation but I don't understand it2010-11-15
  • 0
    @JimJones: Presumably you can't choose $A_1$, because it is given to you. $A_1=aX^3+bX^2+cX+d$ would be one of $4$ equations you can write down when trying to determine the coefficients of your polynomial in terms of your given data.2010-11-15
  • 0
    I don't understand how to solve for a letter, I can't get my variables to cancel out2010-11-15
  • 1
    @JimJones: $A_1$, $X$, $Y$, they are *not* variables: they stand for numbers. The "variables", the **unknowns**, are $a$, $b$, $c$ and $d$. But without specific values for $A_1$, $A_2$, $B_1$, $B_2$, $X$, and $Y$, this will be hopeless to do without either linear algebra or some other knowledge. One possibility is Hermite Interpolation. Look it up!2010-11-15
  • 0
    @Arturo Magidin: I looked up Hermite Interpolation but don't understand it. Could you help me apply it to my problem?2010-11-15
  • 1
    The problem I'm having is that I don't know how to apply any of your answers without having actual numbers.2010-11-15
  • 0
    Arturo. I don't see how your last comment is helpful. It is very hard to judge something like "mathematical sophistication" based on a few comments on a website. I think your *other* comments have been very good and helpful. (And I have rated them up.) But, *what use* is it to say something that seems to imply that he should just give up? It is through moments like this that "mathematical sophistication" develops. He is seeking help and doing so respectfully. Let's return the same or be quiet.2010-11-15
  • 0
    @don: Jim's own admission of not having taken linear algebra makes it a bit frustrating to teach, so I can see where Arturo's coming from (He's actually being more patient than I could've been).2010-11-15
  • 1
    @a little don: I think that the confusion and complaints that Jim has made make it reasonably clear that he is just not comfortable enough manipulating expressions with letters that are supposed to be "unspecified numbers" as opposed to unknowns. That *does* speak of a lack of mathematical sophistication. It's somewhat mystifying that my original answer was accepted *at the same time* as he complains he cannot understand it or make it work. Not to mention frustrating (likewise that the original question does not make it clear what it is he is looking for).2010-11-15
  • 0
    Would someone be willing to walk me through Hermite Interpolation without actual numbers? I'm having difficulty trying to teach myself through wikipedia2010-11-15
  • 0
    @JimJones: I've tried a different tack; see if that is what you are hoping for.2010-11-15

2 Answers 2

5

In general, there are many possible answers. But, suppose your polynomial looks like this: $$f(X) = a_n X^n + \cdots + a_1 X + a_0$$ with $a_0,\ldots,a_n$ real numbers. Then $$f'(X) = na_n X^n + \cdots + a_1.$$ Evaluating at $x$ and at $y$ will give you a bunch of equations that they need to satisfy: \begin{align*} a_n x^n + \cdots + a_1x + a_0 & = A_1\\ na_n x^{n-1} + \cdots + a_1 &= B_1\\ a_n y^n + \cdots a_1y + a_0 &= A_2\\ na_n y^{n-1} + \cdots a_1 &= B_2. \end{align*} You cannot really to get an answer if the degree of the polynomial is $0$ or $1$: too many equations with too few unknowns. Degree $2$ would give you four equations with three unknowns, which may be too restrictive as well. So your best hope of having it be solvable and not too hard is for the degree (for $n$) to be $3$. Then you'll have a bunch of equations like so: $$\begin{array}{rcrcrcrcl} a_3 x^3 &+& a_2 x^2 &+& a_1 x &+& a_0 &=& A_1\\ a_3 y^3 &+& a_2 y^2 &+& a_1 y &+& a_0 &=& A_2\\ 3a_3 x^2 &+& 2a_2 x &+& a_1 & & &=& B_1\\ 3a_3 y^2 &+& 2a_2 y &+& a_1 & & &=& B_2. \end{array}$$ So you go ahead and solve this system in one of the standard ways; for example, back substitution if you don't know the methods from linear algebra.

Added: How to solve these if you don't know linear algebra? The less sophisticated method is probably to "solve and backsubstitute". Using the last equation, you can write $a_1$ using $y$, $a_2$, $a_3$, and $B_2$. Substitute that value into each of the previous three equations, and then each of those equations only has three unknowns. Then use one of them to write $a_2$ in terms of the other two unknowns, and substitute that into the remaining two equations. Then use one of them to "solve" for one unknown in terms of the other, and substitute into the remaining one. Solve for the unknown, and then work backwards.

For example, suppose that $x=2$ and $y=3$, $A_1 = -2$, $A_2=1$, $B_1 = 0$, and $B_2 = 1$ (I just picked those at random). So the equations become: $$\begin{array}{rcrcrcrcl} 8a_3 &+& 4a_2 &+& 2a_1 &+& a_0 &=& -2\\ 27a_3 &+& 9a_2 &+& 3a_1 &+& a_0 &=& 1\\ 12a_3 &+& 4a_2 &+& a_1 & & &=& 0\\ 27a_3 &+& 6a_2 &+& a_1 & & &=& 1. \end{array}$$ From the last equation, you have that $a_1 = 1 - 27a_3 - 6a_2$. Plugging that into each of the other three equations you get: $$\begin{array}{rcrcrcl} -36a_3 & - & 8a_2 & + & a_0 &=& -4\\ -54a_3 & - & 9a_2 & + & a_0 & = & -2\\ -15a_3 & - & 2a_2 & & & = & -1. \end{array}$$ Then we can use the first equation to write $a_0 = 36a_3 + 8a_2 - 4$, and substituting into the second equation we get $$\begin{array}{rcrcl} -18a_3 & - & a_2 & = & 2\\ -15a_3 & - & 2a_2 & = & -1. \end{array}$$ From the first equation you get $a_2 = -18a_3-2$, which plugged into the second equation gives $21a_3=-3$, or $a_3 = -\frac{1}{7}$. This gives you the value for $a_2$, since you know $a_2 = -18a_3-2$; once you have $a_2$ and $a_3$, you use $a_0 = 36a_3+8a_2-4$ to find $a_0$; once you have $a_0$, $a_2$, and $a_3$, you use $a1 = 1 - 27a_3 - 6a_2$ to find $a_1$.

You can do the back-substitution in any order; this is not the best way of doing it, but it's certainly a way that may have occurred to you if you have ever solved a system of two equations with two unknowns. It's called "back-substitution" because you use one equation to isolate a variable, then you "substitute it" into the equations that are "at the bacK", the other equations.

Trying to do this for more equations with more unknowns quickly becomes far too annoying, which is why there are better methods, such as Gaussian Elimination.

Added 2: If, as your comments in the question suggest, you are supposed to come up with generic formulas for arbitrary numbers $A_1, A_2,B_1,B_2$, $x$, and $y$, then this method is difficult, though you can push it through if you are careful and are really comfortable with algebra. You have to remember that $x$, $y$, $A_1$, $A_2$, $B_1$, and $B_2$ are supposed to be numbers, not variables, so if you can write $a_i$ in terms only of these, then you've "solved" $a_i$. Your final answer would express $a_0$, $a_1$, $a_2$, and $a_3$ in terms of $A_1$, $A_2$, $B_1$, $B_2$, $x$, and $y$.


Added 3: Your comments clearly say now that you are trying to come up with formulas that you can just plug $x$, $y$, $A_1$, $A_2$, $B_1$, and $B_2$ into to get your polynomial. You are not going to be able to come up with them using the methods discussed so far. Not because it's impossible, but because you are not exhibiting the kind of comfort with algebra that you would need for that. It would involve carrying around fairly ugly expressions around in a comfortable way, and it seems clear you cannot do this.

So let's try a slightly different tack.

Start slow. A simple way to get a polynomial that will give you $A_1$ when evaluated at $x$ and $A_2$ when evaluated at $y$ is to "cheat": make it a sum of two polynomials, one zero at $x$ and the other zero at $y$, and then just adjust things so they come out right. So you can take, for example, something like $$f(X) = K(X-x) + M(X-y).$$ Then $f(x) = M(x-y)$ and $f(y)=K(y-x)$. So you get easy formulas for $M$ and $K$: since $M(x-y)=A_1$, then $M = A_1/(x-y)$ (which you can do because $x\neq y$); and since $K(y-x) = A_2$, then $K=A_2/(y-x)$. So we get $$f(X) = \frac{A_2}{y-x}(X-x) + \frac{A_1}{x-y}(X-y).$$ Now, this is not going to do it for the derivatives, though. So we are going to have to add things to this polynomial to get the derivatives to come out right. How can we add things so as not to mess up what we've already achieved (that the first two equations are satisfied)? Well, we can make sure we don't mess up what we already have if we make sure that whatever we add has value $0$ at both $x$ and $y$. So we'll try something like: $$f(X) = \frac{A_2}{y-x}(X-x) + \frac{A_1}{x-y}(X-y) + (X-x)(X-y)g(X)$$ for some $g(X)$. What is the derivative of such an $f(X)$? Remembering that $x$, $y$, $A_1$, and $A_2$ are numbers, then applying the product rule we have: $$f'(X) = \frac{A_2}{y-x} + \frac{A_1}{x-y} + (X-y)g(X) + (X-x)g(X) + (X-x)(X-y)g'(X).$$ If you evaluate at $x$, we get $$B_1 = f'(x) = \frac{A_2}{y-x}+\frac{A_1}{x-y}+(x-y)g(x).$$ Everything is numbers that we'll know, except for $g(x)$. So that means that we need $$g(x) = \frac{B_1}{x-y} - \frac{A_2}{(y-x)(x-y)} - \frac{A_1}{(x-y)^2}.$$ And if we evaluate $f'(X)$ at $y$ we get $$B_2 = \frac{A_2}{y-x} + \frac{A_1}{x-y} + (y-x)g(y).$$ Again, everything except $g(y)$ are numbers we already are supposed to know. So we get: $$g(y) = \frac{B_2}{y-x} - \frac{A_2}{(y-x)^2} - \frac{A_1}{(x-y)(y-x)}.$$ Notice that the derivative of $g(X)$ turns out to not play any role at all after all! So we can make $g(X)$ as simple as we possibly can; say, a linear polynomial.

How can we achieve this? Well, we discussed above how to make a polynomial of degree $1$ that has specific values at two different points, right? So you can just use the same trick we used for $f(x)$ and $f(y)$, but with $g(x)$ and $g(y)$, using the (complicated) expressions we just found for $g(x)$ and for $g(y)$ instead of the $A_1$ and $A_2$ that we used for $f(X)$. So go to it.

Note: You can keep playing with this if you have still more points-and-values; it gets progresssively more difficult. You would need to start with polynomials of degree $n-1$ if you know the value at $n$ points; this leads you to Lagrange Interpolation polynomials. The advantage of the linear algebra method is that the complexity grows in a bit more manageable fashion than this method.

  • 0
    I don't understand how to solve these equations, that's my problem.2010-11-15
  • 0
    @JimJones: Added to body.2010-11-15
  • 0
    I don't understand how to use back substitution when I can't isolate any of the variables2010-11-15
  • 0
    @JimJones: Perhaps you could have waited until I finished writing my addition? Or is the assignment due in a few minutes?2010-11-15
  • 0
    I'm sorry, I was unaware you were still writing something. It's not an assignment, I'm just trying to understand what we are doing in class using the book exercises2010-11-15
  • 0
    Arturo: I am sad that I cannot upvote this more than once; you've explained it better than I could've. I was planning to demonstrate the divided-difference approach, but decided against it when Jim showed difficulty in parsing the first few hints.2010-11-15
  • 0
    Teeny nitpick to your otherwise nice answer: "Lagrange" applies only technically to interpolating at points; once derivatives come into play, it's now called "Hermite".2010-11-15
  • 0
    @J.M.: Yes; I mention Lagrange polynomials right after "You would need to start with polynomials of degree n-1 if you know the value at n points"; that is, to get started before looking at the derivative (before trying to figure out what I called $g(x)$)2010-11-15
3

This would be a typical question given in the beginning of a linear algebra class. You have the information that $f(x)$ passes through the points $(X,A_1)$ and $(Y,A_2)$ and $f'(x)$ passes through the points $(X, B_1)$ and $(Y,B_2)$.

So you have a set of 4 linear equations for 4 unknowns. Try setting up a linear system and solving it. Hint: The first condition could be written as $$[X^3 \;\; X^2 \;\; X \;\;\; 1] \left[\begin{array}{c}a\\ b\\ c\\ d\\\end{array} \right] =A_1 $$

When you put together all 4 of your equations you end up with an augmented matrix which you can put in RREF form to find your answer

  • 0
    I'm sorry, I've never taken linear algebra. I feel like this is supposed to be really simple but I just don't understand it at all2010-11-15