# Deducing a function

Via @MathsRH on twitter:

Not required for what this question was asking but does anyone want to play guess the function? pic.twitter.com/xohiIjj2gV

— RHMaths (@MathsRh) October 15, 2022

In case you can’t see that, it’s a challenge to come up with a function that matches a given picture, which I’ll describe in a moment; if you can see it, working out the key points is part of the problem-solving, so the description might constitute a spoiler or an accessibility aid depending on where you are in the process. I’ll put a line before it in any event.

—

The picture shows a continuous curve that drops down from a large $y$ value to a minimum at $(-2,0)$. If then rises to a maximum at $(0,6)$, before dropping towards a horizontal asymptote at $y=3$.

–-

This is a point where I would bring out the DATAS framework.

**Domain**. We’re not told anything about the domain, but there’s no vertical asymptote marked and I’ll assume the function is defined for all $x$.**Asymptotes**. As $x \to +\infty$, $y\to 3$, and I’m assuming that as $x \to -\infty$, $y \to +\infty$.**Turning points**. Clearly $(-2,0)$, minimum, and $(0,6)$, maximum.**Axes**. Touches the $x$-axis at $(-2,0)$, crosses the $y$-axis at $(0,6)$.**Shape**. I think we’re looking at some variant on an $e^{-x}$ function.

But what variant? There are infinitely many possibilities, but I’ve zoomed in on one: $y = e^{-x}p(x)+3$, for some polynomial.

Why this? I want something that’s dominated by the 3 when $x$ is large, and by the $e^{-x}$ when $x$ is large-negative, but also has the possibility to have some turning points in between. The question is, what polynomial?

Let’s look at its derivative. This rises from steep negative, hits 0 at $x=-2$, peaks and drops to 0 again at $x=0$, then approaches the $x$ axis from below. Something like $e^{-x} q(x)$, where $q(x)$ is a quadratic, might work.

The quadratic would need to be of the form $q(x) = kx(x+2)$ to have the zeros in the right place, so we have $y’ = ke^{-x}x(x+2)$.

If we integrate that (tediously, by parts twice), we get $y= ke^{-x}(x^2 + 4x + 4)+C$.

At first glance, that looks great – it even goes through $(-2,0)$! But that’s not great. The horizontal asymptote is at the same height as the turning point, and there’s no way around that in this form.

At this point, dear readers, I sighed, and wondered if I should break out the quartics. But then my brain suggested that there’s no particular reason to pick $e^{-x}$ over, say, $e^{-2x}$, other than laziness.

And indeed, if we make $y’ = ke^{-2x}x(x+2)$, we get $y = Ke^{-2x}(2x^2 + 6x + 3)$, which is better – although still not quite right. The turning points need to be equally spaced about the $x$-axis. So we have another parameter to throw in.

### Deep breath

If we let $y’ = ke^{-ax}x(x+2)$, we get $y = ke^{-ax} \left( \frac{1}{a}x(x+2) + \frac{2}{a^2}(x+1) + \frac{2}{a^3}\right)$, an answer only Wolfram|Alpha could love.

Where are the turning points? When $x=0$, we get $y=2k\left(\frac{1}{a^2}+\frac{1}{a^3}\right)$.

When $x=-2$, we get $y = 2ke^{2a}\left(-\frac{1}{a^2} + \frac{1}{a^3}\right)$.

These need to sum to zero, so $2k\left( \left(\frac{1}{a^2} + \frac{1}{a^3}\right)+e^{2a}\left(\frac{1}{a^3}-\frac{1}{a^2}\right)\right)=0$

Clearly $k$ can’t be 0, so let’s multiply by $\frac{a^3}{2k}$ to get $(a+1) + e^{2a}(1-a)=0$.

I suspect this isn’t going to come out neatly. Let’s try: $1 + e^{2a} = a(e^{2a}-1)$, so we have $a = \coth(a)$. That is *not* a pleasant number – it’s a bit short of 1.2, and I’ll call this $A$.

If $k=1$, then this crosses the $y$-axis at $\frac{2}{a^3}(a+1)$, which is about 2.548 – but we want it to be 3. So $k = 3 \div \left(\frac{2}{A^3}(A+1)\right)$, or $\frac{3A^3}{2(A+1)}$.

And, after all of that, we need to add 3 to get the asymptote and turning points in the right place.

So, our final curve is $y = \frac{3}{2(A+1)} e^{-Ax}\left( A^2 x(x+2) + 2A(x+1) + 2\right)$, where $A$ satisfies $A= \coth(A)$.

—

That came out significantly less nicely than I expected it to! There are, presumably, any number of functions that fit the bill. Can you find a nicer one?