2

I need a quadratic equation that meets the following $5$ constraints:

  • If $x = 1$ then $y = 100$
  • If $x = 3$ then $y = 80$
  • If $x = 5$ then $y = 40$
  • If $x$ approaches infinity then $y$ approaches $0$
  • The maximum $y$ for $x$ in domain $[1, +\infty)$ is $100$

I used various curve fitting technologies but the closest I get is

$y = \frac{800}{(x ^ 2 - 3 x + 10)} $

Unfortunately this formula doesn't meet the last constraint because the $y$ value between $1$ and $2$ is more than $100$ in that case.

If possible I would like to have an equation with natural numbers like the one above.

Jose M Serra
  • 2,583
  • Thanks for the clarification! Not sure if it helps though; turns out to be trickier than I thought at first glance :) – Cleb Oct 29 '16 at 14:33
  • What is the range for the 5th constraint? Between 1 and...? – Cleb Oct 28 '16 at 17:20
  • @Cleb, sorry I used a domain notation that is not that well-known. I have edited my question. Does this help? –  Oct 28 '16 at 20:05
  • Any quadratic equation with nonzero leading coefficient will approach either infinity or negative infinity as x goes to infinity. Do you mean the reciprocal of a quadratic? – TomGrubb Nov 07 '16 at 01:44
  • 2
    y = 800 / (x ^ 2 - 3 * x + 10) This is not a quadratic. Please explain what family of functions you have in mind. – dxiv Nov 07 '16 at 02:21
  • @bburGsamohT, sorry for being unclear. Indeed I mean the reciprocal of a quadratic. I am really curious whether you can find a solution. – Paul Jansen Nov 08 '16 at 15:31
  • 3
    Given the first three conditions there is only one function of the form $y = 1/(ax^2+bx+c)$ that satisfies them. So if it does not satisfy the last condition, you are out of luck here; you will have to switch to a different class of functions. –  Nov 11 '16 at 00:02
  • Please take a look at the MathJax formatting of your question, which is common at this site – Han de Bruijn Nov 11 '16 at 12:03

2 Answers2

5

A quadratic function (I believe you mean function rather than equation) has this form:

$$y = ax^2 + bx +c$$

With your three conditions for specific values on $y$ and $x$ we can have a $3\times3$ equation system and solve for $a,b,c$. However, we do not have to bother doing this, because we know beforehand that your fourth condition ($y\rightarrow 0$ as $x\rightarrow \infty$) will not be met because quatratic functions can only go to $+\infty$ or $-\infty$, as $x\rightarrow \infty$.

In your example however I see that you do not use a quadratic function, but instead use $$y = \frac{1}{ax^2 + bx +c}$$

This function will go to $0$ as $x\rightarrow \infty$. And using the first three conditions you can again solve the $3\times3$ system and get the right values for $a,b,c$. You have done this correctly and found the fitting function. You have also discovered that your 5th condition is not met because this function has its maximum at $x=1.5$

It seems to me that you chose a family of functions that you know go to zero as $x\rightarrow \infty$, so you are left with 4 conditions instead of 5. This family of functions has only 3 parameters which make it improbable to satisfy all 4 conditions. Indeed this is what you have discovered. However, my impresion is that you do not know what the function family is, it is not given a priori to you. You just want to find a function that fits your criteria (and make this function as simple as you can).

One option would be to use a $3^{rd}$ degree polynomial in the denominator. So consider functions of the form:

$$y = \frac{1}{ax^3 + bx^2 +cx+d}$$

How do we find the parameters $a,b,c,d$? We already have your three conditions on values of $x,y$, we need just one extra condition. We want the maximum in the domain $[1, +\infty)$ to be at $x=1$, which means that we want the function to be decreasing for $x\ge 1$. Given our function family, this translates into the derivative of the function being $0$ at a point $x\le 1$.

Edit: Actually this is not a necessary nor a sufficient condition! The derivative of the function above has (up to) two real roots. So, given our other three conditions (i.e., the 3 points that the function has to pass through), a necessary and sufficient condition is either: 1) the derivative has no real roots, or 2) both roots of the derivative are $\le 1$.

The derivative of the above function is: $$\frac{dy}{dx} = -\frac{3ax^2+2bx+c}{(ax^3+bx^2+cx+d)^2}$$

The roots of the derivative are:

$$\frac{-\sqrt{b^2 -3ac}-b}{3a}\text{ and }\frac{\sqrt{b^2 -3ac}-b}{3a}$$

Note that the derivative does not have roots if $b^2 -3ac <0$. In this case we get one (infinite) set of solutions. If, on the other hand, $b^2 -3ac >0$ then we have two real roots and we have to make them both $\le 1$. Since we cannot tell from the formulas which root is the larger and which is the smaller, we cannot simply set the larger one to be some value $\le 1$. What we can do though is pick a point $x\le 1$ and make the derivative to be $0$ at that point. This will gives us one equation on $a,b,c,d$. Using the other three constraints on the $x,y$ values, we get three more equations and we can solve the $4\times 4$ system. Once we have the solution we can check that both derivative roots are $\le 1$. For example, if we make the derivative to be $0$ at $x=1$ we get this solution: $$ \left. \begin{array}{rl} -\frac{3a+2b+c}{(a+b+c+d)^2} &= 0\\ \frac{1}{a+b+c+d} &= 100 \\ \frac{1}{27a+9b+3c+d} &= 80 \\ \frac{1}{125a+25b+5c+d} &= 40 \end{array} \right\} \iff \begin{array}{rl} a &= \frac{1}{6400}\\ b &= -\frac{1}{6400} \\ c &= -\frac{1}{6400} \\ d &= \frac{65}{6400} \end{array} $$ Solved using this online tool

One derivative root is at $1$ (as we dictated in the constraints) and the other one is $-1/3$. So this solution satisfies our constraints, which means that this function has all the properties you are looking for: $$\frac{6400}{x^3 -x^2 -x+65}$$

As another example, if we set the derivative to be zero at $x=0$, we get this function, which again satisfies all conditions. $$\frac{18400}{3x^3 -4x^2 +185}$$

If you plot them, both functions look quite similar:

$\hskip2in$plot fitting function

We also have infinite solutions of this form. If we want to present all solutions in a parametric form we can do the following: Take the three initial conditions (i.e., function passing from the 3 points) and solve the $3\times4$ system to get a parameteric representation of $a,b,c,d$.

$$ \left. \begin{array}{rl} \frac{1}{a+b+c+d} &= 100 \\ \frac{1}{27a+9b+3c+d} &= 80 \\ \frac{1}{125a+25b+5c+d} &= 40 \end{array} \right\} \iff \begin{array}{rl} a &= \frac{80t-1}{1200}\\ b &= -\frac{96t-1}{160} \\ c &= -\frac{3680t-37}{2400} \\ d &= t \end{array} $$

Then apply the necessary and suffient condition we have found in order to get a descreasing function for $x\ge1$.

So either the derivative has no real roots: $$b^2 -3ac <0 \iff -\frac{\sqrt{33}-7}{1280}<t<\frac{\sqrt{33}-7}{1280} $$ Or the derivative has real roots and they are all $\le 1$: $$b^2 -3ac \ge 0 \quad \cap \quad \frac{-\sqrt{b^2 -3ac}-b}{3a}\le 1 \quad \cap \quad \frac{\sqrt{b^2 -3ac}-b}{3a}\le 1$$

For the latter case, the condition on $t$ gets too long to write here but you can find it here.

So we have found a family of functions to satisfy your conditions, but it is important to understand what kind of functions you are dealing with in your context. There are many families of functions that can satisfy your conditions. Choosing the reciprocal of a $3^{rd}$ degree polynomial is arbitrary, I just extended the path you initially took.

Exponential functions, for example could work too. Consider this family of functions: $$y = e^{-(ax^2 + bx +c)} $$ If we can make this function pass from your 3 points then the other two conditions are met, i.e. $y$ is strictly decreasing for $x> 1$, and $y\rightarrow 0$ as $x\rightarrow \infty$. This is easier to solve than the reciprocal $3^{rd}$ degree polinomial. We simply solve this $3\times3$ system: $$ \left. \begin{array}{rl} -(a+b+c) &= ln(100)\\ -(9a+3b+c) &= ln(80)\\ -(25a+5b+c) &= ln(40)\\ \end{array} \right\} \iff \begin{array}{rl} a &\approx 0.05875\\ b &\approx -0.12343 \\ c &\approx -4.54049 \\ \end{array} $$

But if you wanted integer coefficients in your formula as you mention, then you cannot use this family.

Thanassis
  • 3,175
2

If the allowable set of functions is $y=1/$some quadratic in $x$, your first three conditions are sufficient to determine the function. You have found the correct interpolating function of that class. Then if it doesn't satisfy the fourth and fifth conditions there is nothing you can do. You need to decide what you are willing to give up. If you raise the allowable degree of the polynomial you can do it. For example, if you are willing to divide by a cubic you can use $y=3200/(x^3-5x^2+11x+25)$ which meets all your conditions

Ross Millikan
  • 374,822