Wednesday, October 8, 2008

Integration By Parts

Professional Calculus 1 and 2 Study DVDs.

Integration By Parts - this is a method for solving integrals involving products of functions. By products of functions we mean:

f(x)g(x), or xCos[x], where x is a function and Cos[x] is a function. Here is the parts formula:

\int_a^b f(x) g'(x)\, dx = \left[ f(x) g(x) \right]_{a}^{b} - \int_a^b  f'(x) g(x)\, dx\!
Now, you might wonder how this was derived...well, this is derived from the product rule. Recall the product rule for differentiation:

(f\cdot g)'=f'\cdot g+f\cdot g' \,
If this isn't making sense yet don't worry. What you need to realize is that the integral of the left side of the above equation, is simply f*g. Remember that the integral of a derivative, is just a function. Quickly:

f(x) = x^2
f '(x) = 2x
Integral of 2x = (2 *x^2)/2, and the 2s cancel leaving us with x^2 or f(x).

So, since the left and right side of any equation are equivalent :-), we can also integrate the right side of the equation. After recalling the fact above, that the derivative of an integral is just the function and a little rearranging we arrive at the integration by parts formula. Look at the below.

  • First is the product rule
  • Then you integrate the derivative to get back the original f(x)*g(x) function.
  • Then you rearrange the equation...that's it.

(note, in the first line, that's g ' (x), ignore the carrot, there is no exponent)

Let's do a integration by parts problem:

Notice here, U substitution doesn’t work. There’s no trig substitution to fall back on and there is no immediately obvious antiderivative.

Let’s use integration by parts, note, we will be replacing f and g with u and v, don’t get too excited!

\int u\, dv=uv-\int v\, du.\!

So how do you choose u and v? Good question, let’s think about it for a second. Looking at the integration by parts formula, you have to take the antiderivative of u on the right side of the equation. The goal is always to get a simpler integral on the right side of the equation. So if differentiating u creates a integral more complicated than the original integral on the left, don’t use it.

Note that we choose u, lnx so that it's derivative is easy to integrate, it happens to cancel nicely with the antiderviate of dv, so enjoy that while you can.

So we have our answer, the indefinite integral is highlighted. Note, a few principles used in the simplification included reducing the power of the exponent and eliminating the x in the denominator, and bringing out a constant in front of the integral.

Also - in case that wasn't enough (I doubt it), some great videos on integration by parts on YouTube. And if you like cheap books, check out th

e iChapters ad on the right. You can buy individual chapters, in PDF format for a few bucks a piece...that's a cool deal!

So we have our answer, the indefinite integral is highlighted. Note, a few principles used in the simplification included reducing the power of the exponent and eliminating the x in the denominator, and bringing out a constant in front of the integral.

Wednesday, October 1, 2008

Chebyshev's inequality + Examples

Professional Calculus 1 and 2 Study DVDs.

Chebyshev's inequality:In very common language, it means that regardless of the nature of the underlying distribution that defines the random variable (some process in the world), there are guaranteed bounds to what % of observations will lie within K standard deviations of a mean.

So you need the following:

- Mean of the probability distribution
- Standard deviation or variance of the distribution, recall that variance is stdev^2

Let's do a simple example:

The length of a knife is on average 5 inches long, with a standard deviation of 1/10th of 1 inch. What % of observations will be between 4.75 and 5.25 inches long? We can approach this several ways, but let us take the most intuitive route:

The mean is 5 we're trying to find how often knives will be within 1/4 inch on either side of the mean. Now, if a knife is 5.25 inches, how many standard deviations is the length off by? Recall that our standard deviation is .1 inches. So, .25 inches/.1inch = 2.5 standard deviations. Note that this means that:

mean +/- 2.5 standard deviations = the range of lengths 4.75 to 5.25 inches.

Now we can solve the problem:

\mathrm{Pr}\left(\left|X-\mu\right| \ge k\sigma\right) = 1/k^2.\,
Let's think about this statement. It says the chance that the absolute difference between the observed length and the mean is greater than k standard deviations (k is arbitrary, it could be anything), is equal to 1/k^2. Now k is the # of standard deviations.

So this gives the probability that the observation will be GREATER than k standard deviations. We are trying to find the probability that it's on some interval namely, 4.75 to 5.25 inches. So, if the above is P(A), than the probability we want is 1-P(A).

So let's do it:

1 - 1/k^2 = 1-1/2.5^2 = 1 - 1/6.25 = 1-.16= 84% (.84 = 84%).

So, that's it. Keep in mind this assumes that the MEAN IS KNOWN and the VARIANCE OR STDEV IS KNOWN. If those are not known, you can't use this. And for completeness, what is the probability that the knives observed will be off the 4.75 inch to 5.25 inch interval?

Well, it's just 1-P(that they're on the interval) so 1-84% = 16% OR, and I hope you're thinking about this already, 1/2.5^2 = 1/6.25 = 16%. So that odds that they are either ON or OFF the interval, the union of 2 mutually exclusive events is just their sum, 84%+16% = 100%.

Wikipedia on the subject:

In probability theory, Chebyshev's inequality states that in any data sample or probability distribution, nearly all the values are close to the mean value, and provides a quantitative description of "nearly all" and "close to".

In particular,

* No more than 1/4 of the values are more than 2 standard deviations away from the mean;
* No more than 1/9 are more than 3 standard deviations away;
* No more than 1/25 are more than 5 standard deviations away;

and so on. In general:

* No more than 1/k2 of the values are more than k standard deviations away from the mean.

Let X be a random variable with expected value μ and finite variance σ2. Then for any real number k > 0,

\Pr(\left|X-\mu\right|\geq k\sigma)\leq\frac{1}{k^2}.

Only the cases k > 1 provide useful information. This can be equivalently stated as

\Pr(\left|X-\mu\right|\geq \alpha)\leq\frac{\sigma^2}{\alpha^2}.

As an example, using k = √2 shows that at least half of the values lie in the interval (μ − √2 σ, μ + √2 σ).

Typically, the theorem will provide rather loose bounds. However, the bounds provided by Chebyshev's inequality cannot, in general (remaining sound for variables of arbitrary distribution), be improved upon. For example, for any k > 1, the following example (where σ = 1/k) meets the bounds exactly.

\begin{align} & \Pr(X=-1) = 1/(2k^2), \\ \\ & \Pr(X=0) = 1 - 1/k^2, \\ \\ & \Pr(X=1) = 1/(2k^2). \end{align}

For this distribution,

\mathrm{Pr}\left(\left|X-\mu\right| \ge k\sigma\right) = 1/k^2.\,

A one-tailed variant with k > 0, is

\Pr(X-\mu \geq k\sigma)\leq\frac{1}{1+k^2}.

Saturday, April 19, 2008

Natural Logarithm as An Integral

Professional Calculus 1 and 2 Study DVDs.

Today we'll look at the natural logarithm lnx as an integral. Let's first consider the function ln(x), which is the natural logarithm of x. d/dx ln(x) = 1/x, so we can say that the integral of ln(x) from 1 to x is the value of ln(x) at x, because ln(x) at x = 1 is 0. Here's a better visual. Pay attention to the black writing in the top right of the image.

Again, this simply states that the antiderivative or definite integral of 1/x is the natural logarithm of x. Here note that as this is a definite integral there are limits of integration, namely 1 and be sure to realize that the end limit of integration is varying in this case and can take on any value so long as it's greater than 1. If it's less than 1, (x < ln2 =" .693."> 2 is just ln(2).

You'll see in the first image that I've also computed the area under the curve from .5 to 1. It happens to be exactly the same as the area from 1 to 2, but if you compute the natural logarithm of .5 you'll get -.693, thus requiring you to keep in mind that although the sign of the result is negative, the area is most certainly positive.

So there you go, a simple example of the natural logarithm as an integral of 1/x. Keep in mind integration and differentiation are reverse processes. You were given a function and were asked to the area under it on an interval. You took the integral (or antiderivative) of the function and although we neglected to mention it, you took the difference of the limits of integration evaluated using the integral of 1/x - we ignored Ln(1) as it equals zero - but to be formal.

Integral of 1/x = Ln(x) | Area between 1 and 2 equals Ln(2) - Ln(1) = Ln(2) = .693.

This practice is derived from the fundamental theorem of calculus:
f(x) = F'(x)\,.


\int_a^b f(x)\,\mathrm dx = F(b) - F(a)

Here's a great video on the fundamental theorem if you'd like to brush up/learn more about it.