Why can't I differentiate this nomal/Guassian distrubution?
January 17, 2014 7:50 AM   Subscribe

Have a look here. I'm assured that differentiating 1, with respect to x, gets you 2. Now 2 is - I think, and correct me if I'm wrong - equivalent to 3. The problem is I can't see how 3 is the result of differentiating 1. What's more, an online solver produces something (that looks) very different. Can someone help me out?
posted by ed\26h to Science & Nature (9 answers total)
I think Wolfram Alpha is better at differentiating these things. They will give you two step-by-step solutions per day for free if you register.
posted by zscore at 8:04 AM on January 17, 2014

Step 2 is the derivative. Step 3 is substituting equation 1 into the "N" in equation 2. 2 and 3 are identical, 3 is just a more full solution.
posted by no regrets, coyote at 8:10 AM on January 17, 2014

When you differentiate 1, the exponential factor itself is unchanged, because it's an exponential. The only thing that happens is you must multiply by the derivative of what's inside the exponential, due to the chain rule. That derivative is this. (3) is simply (1) times this factor.

The online solver you linked to has produced the same result, but written in a really funny way, splitting the square root into individual factors and writing sqrt(sigma^2) as abs(sigma)--which is technically the same, but it's a really non-conventional way to write it.
posted by Aquinas at 8:15 AM on January 17, 2014

You're correct that they're all the same. To see why the online solver and your expression #3 are the same, note the following:
  • √(σ2) is the same thing as the absolute value of σ (which is written as |σ|.
  • That means that √2 * √π * |σ| = √2 * √π * √(σ2) = √(2*π*σ2) = (2*π*σ2)1/2.
  • ewhatever and exp(whatever) are two ways of writing the same thing.
So the expression from the online solver contains all the "pieces" of your expression #3; the online solver just smushes them all together into one fraction. Try writing the two expressions out side-by-side and compare the quantities in the numerators & denominators one by one; you'll find that each quantity in #3 has a corresponding quantity in the online solver's version.

Apologies if my answer is overly pedantic, but I wasn't exactly sure which step you weren't seeing.
posted by Johnny Assay at 8:15 AM on January 17, 2014

Your equation 3 has three terms. The first term is the constant factor that also appears in Equation 1, and remains unchanged through differentiation. The second term is the function e^(something), which also appears in the first equation, and remains unchanged via the properties of the generic function e^y under differentiation. Of course, when differentiating e^y with respect to say x, if y is a function of x, you need to use the chain rule. Thus the third term in your equation 3 is the derivative of the (something) with respect to x. (note: strictly speaking, the negative sign at the beginning of the expression comes from the third term, but conventional notation likes to place the negatives at the beginning)

Your equation #2 just takes the first two terms of Equation 3 and rewrites them as N, since together they are equivalent to the original function. The results from both online solver and Wolfram Alpha also appear to be equivalent (although written with slightly different factorizations).
posted by grog at 8:18 AM on January 17, 2014

Excellent. Thanks guys. I hadn't understoood that a) the exp was a function of x like any other and b) the minus at the start of 3 originally belonged to its third term. As for the differentiation of that function, does this look sensible?
posted by ed\26h at 4:42 AM on January 18, 2014

As for the differentiation of that function, does this look sensible?

As someone who does differentiation all the time, it looks overly pedantic to me — like it was generated by an algorithm rather than a person who truly understood the method. But there's nothing wrong with any of the steps.
posted by Johnny Assay at 7:17 AM on January 18, 2014

While the answer is correct, I suspect you might be abusing the rules of differentiation. When you differentiate (x-u)^2, you can't just pull the 2 down and call it a day. You have to expand the expression into x^2 - 2ux + u^2 and differentiate each term separately. In this case you get the same answer either way, but that is a coincidence! You could also use the chain rule, and maybe that's what you're doing, but either way your technique is not explicit in your derivation, which makes me think you "got lucky" by misapplying the simpler rule.
posted by grog at 7:41 AM on January 18, 2014

For what it's worth, I would differentiate (x-u)^2 as 2(x-u) by using the chain rule (in its most trivial possible form) without making an explicit step for it. But it's good to be sure that the OP understands all the steps of what he's doing.
posted by dfan at 3:53 PM on January 18, 2014

« Older Help me get a job as a CNA in a hospital! Advice...   |   The American Dream of Co-op Issued Share Ownership Newer »
This thread is closed to new comments.