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.

I.e. 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.

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.

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.