nth derivative is n^2 at zero (I've been nerd sniped.)

My students are evil and keep nerd sniping me. This is supposedly a brain teaser given at university, but I’ve racked my brain for quite a bit, and although I’ve found some interesting sequences I haven’t solved it. And it’s rather google resistant.

The problem is pretty much as described in the title:

Find a function f(x), so that the nth derivative is n[sup]2[/sup] at zero.

f’(0) = 1
f’’(0) = 4
f’’’(0) = 9
and so on.

I’ve found one that gives 1, 2, 3, 4, … but so far no manipulation gives the desired sequence.

[spoiler]Consider the Taylor series:
f(x) = f’(a)x + f’’(a)x^2/2! + f’’’(a)x^3/3! + f’’’’(a)x^4/4! + …

Plug in the known coefficients:
f(x) = 1x + 4x^2/2! + 9x^3/3! + 16x^4/4! + …

Do a little dividing and factor out an x:
f(x) = x(1 + 2x/1! + 3x^2/2! + 4x^3/3! + …)

If we say that:
g(x) = 1 + 2x/1! + 3x^2/2! + 4x^3/3! + …

Then the integral is:
h(x) = 1x + x^2/1! + x^3/2! + x^4/3! + …

Strip off an x:
h(x) = x(1 + x/1! + x^2/2! + x^3/3! + …)

Oh, that looks familiar. So:
h(x) = x*e^x

And so:
g(x) = (x+1)e^x

And then:
f(x) = x(x+1)e^x

Double-checking my answer in Wolfram Alpha, it looks to work.

Yeah, those series are a distant memory, so I’d never have gotten there by that approach. I was really close in my trial and error approach, but I got misled by some of the results where I shouldn’t have been.

Much appreciated!

Sure thing! It was a fun little puzzle that I hadn’t seen before.

Taylor series aren’t too difficult if you’re already comfortable with derivatives, but they can look imposing at first. There’s probably another way to solve this problem, but they were the first thing to come to mind–their entire existence is based on knowing the value of the nth derivative at some point.

Looking into things a bit more, I was curious as to why it worked.

Multiplying through, the function is:
(x^2 + x)e^x

As you know, the product rule is just:
(uv)’ = u’v + uv’

So we have in general that:
u(x)e^x = u(x)e^x + u’(x)e^x = (u(x) + u’(x))e^x

For each new derivative, then, the first part of the function gets added to its derivative, and that becomes the new multiplier. Let’s see what happens when we repeat the process, ignoring the e^x part:
(x^2 + x) + (2x + 1) = (x^2 + 3x + 1)
(x^2 + 3x + 1) + (2x + 3) = (x^2 + 5x + 4)
(x^2 + 5x + 4) + (2x + 5) = (x^2 + 7x + 9)
(x^2 + 7x + 9) + (2x + 7) = (x^2 + 9x + 16)

Ok, neat–we can see what’s happening. The coefficient to x^2 never changes, because the derivative never contains an x^2. The coefficient to x increases by 2 each time because of the derivative of x^2 is 2x. And finally, the constant coefficient increases by increasing odd numbers, which produce the increasing squares (1+3=4, 1+3+5=9, 1+3+5+7=16, etc.).

That constant coefficient is of course what gives us the value of derivative at 0, since any term with x vanishes, and e^0 = 1.