Wikipedia:Reference desk/Archives/Mathematics/2010 November 3

= November 3 =

Sums of random variables, and line integrals
The setting is: Let $$X$$ and $$Y$$ be independent random variables (on the reals), with density functions $$f_X$$ and $$f_Y$$. The standard result for the density of $$X+Y$$ is $$f_{X+Y}(a)=\int f_X(a-t)f_Y(t)dt$$. I'm trying to derive this formula by using a line integral, but I'm getting a different result, so I must be doing something wrong.

This is my reasoning: The joint density of $$(X,Y)$$ on $$R^2$$ is given by $$f_{X,Y}(a,b)=f_X(a)f_Y(b)$$. To find $$f_{X+Y}(a)$$ we should integrate $$f_{X,Y}$$ over the line $$x+y=a$$. We can parametrize this line by the function $$ r: R\rightarrow R^2, r(t)=(a-t, t) $$. Note that $$dr/dt=(-1,1)$$, so $$|dr/dt|=\sqrt{2}$$. Now if we calculate the line integral (as in Line_integral), we get $$f_{X+Y}(a)=\int f_{X,Y}(r(t))|dr/dt|dt=\int f_{X,Y}(a-t,t)\sqrt{2}dt=\int f_X(a-t)f_Y(t)\sqrt{2}dt$$. If we compare this with the textbook result above, then my result has a factor $$\sqrt{2}$$ that is not supposed to be there. Where did I go wrong? Arthena(talk) 10:03, 3 November 2010 (UTC)
 * The problem is in the assumption that the line integral gives the desired result. Let's say we want to find the probability that $$X+Y \in (a-\epsilon,a+\epsilon)$$. This is given by the integral over the region $$a-\epsilon<X+Y<a+\epsilon$$. This region has a thickness of $$\epsilon\sqrt{2}$$, so the integral over it is equal to the line integral times $$\epsilon\sqrt{2}$$. However, by assuming that the line integral will give the density, you have implied that the probability will be the line integral times $$2\epsilon$$ (the density times the interval length). So you'll need to multiply by a correction factor equal to the thickness of the line divided by the corresponding length of the interval of the derived variable.
 * Because this can be confusing, it's best to use the cumulative density wherever possible. -- Meni Rosenfeld (talk) 12:03, 3 November 2010 (UTC)
 * Thanks for the answer. Arthena(talk) 23:38, 3 November 2010 (UTC)

Interpolation on the surface of a sphere
I want to to interpolate along a great circle between two points on the surface of a sphere expressed in polar coordinates as (φs, λs) and (φf, λf), with the interpolated point also expressed in polar coordinates as (φi, λi).

I'm doing this in code, and the best I've come up with is to:


 * 1) Interpret each point as Euler angles (φ, λ, 0.0)
 * 2) Convert the Euler angles to quaternions and use spherical linear interpolation to get an interpolated quaternion Qi
 * 3) Convert Qi to Euler angles
 * 4) Interpret the Euler angles as the interpolated point.

My questions would be: is this complete nonsense, and is there a simpler, or more direct, way of going about it?

78.245.228.100 (talk) 11:46, 3 November 2010 (UTC)


 * For an alternative, how about simply converting your start and end points to Cartesian and taking a linear interpolation of the resulting vectors, converting back to spherical when you want? You could do this symbolically as well; who knows, maybe there are some significant simplifications (though I don't hold out much hope). Seems way simpler than trying to run through Euler angles and quaternions. 67.158.43.41 (talk) 12:38, 3 November 2010 (UTC)


 * If I convert to 3D Cartesian and interpolate linearly I not only deviate from the great circle, but I end up tunelling through the sphere. 78.245.228.100 (talk) —Preceding undated comment added 12:44, 3 November 2010 (UTC).


 * Sorry, I had meant to say, "interpolate and normalize", though then a linear interpolation of the cartesian vectors is a nonlinear interpolation on the surface. However, making the interpolation linear wasn't a requirement in the OP. If it should be, the correction term for the interpolation speed shouldn't be too hard to derive geometrically with a little calculus. You would have to special-case angles larger than 180 degrees as well. Hmm... that special case makes this not nearly as nice as I thought at first. However, after normalizing, you do not deviate from a great circle, since great circles lie in planes running through the sphere's center, which any linear combination of vectors in that plane also lie in.


 * An alternative would be to use a linear map to send the start and end vectors to (1, 0, 0) and (0, 1, 0) with their normal (unit cross product) getting sent to (0, 0, 1). The vectors $$(\cos(\theta), \sin(\theta), 0)$$ for $$0 \leq \theta \leq \pi/2$$ would correspond to the points of interpolation on a sphere. The inverse of the linear map so defined would convert back. I like this method better, since the inverse operation has a very simple form.


 * Edit: you would have to normalize in this case as well, or you could send the end vector to $$(\cos(\phi), \sin(\phi), 0)$$ where $$\phi$$ is the angle between the start and end vectors, which is the inverse cosine of their dot product, or 2pi minus that for interpolations longer than 180 degrees. The upper limit of $$\theta$$ is then $$\phi$$. The inverse is slightly more complicated in this case.


 * Further edit: if my algebra is right, the final interpolation is simply
 * $$(\cos(\theta), \sin(\theta), 0) = c_1 (1, 0, 0) + c_2 (\cos(\phi), \sin(\phi), 0) \mapsto c_1 \mathbf{s} + c_2 \mathbf{e}$$
 * $$ = (\cos(\theta) - \sin(\theta) \cot(\phi)) \mathbf{s} + \sin(\theta) \csc(\phi) \mathbf{e}$$
 * where s is the start vector, e is the end vector, theta and phi are as above. The singularities of this conversion occur at phi=0 or pi, exactly where they should. Sorry for all the edits; I'm alternating this with doing something deeply tedious.... 67.158.43.41 (talk) 13:24, 3 November 2010 (UTC)
 * To implement your interpolate/normalize with constant speed, write $$\gamma:=\hat s\cdot\hat f$$ and $$\delta:=\hat s\cdot\hat\imath$$, where $$\hat\imath$$ is the result. Then define the unnormalized $$\vec\imath=t\hat s+(1-t)\hat f$$ and observe that $$\delta=\frac{\hat s\cdot\vec\imath}{\sqrt{\vec\imath\cdot\vec\imath}}=\frac{t+(1-t)\gamma}{\sqrt{t^2+(1-t)^2+2t(1-t)\gamma}}$$.  Solving gives $$t=\frac{(\gamma-1)(\gamma+\delta^2)-\delta\sqrt{(\gamma^2-1)(\delta^2-1)}}{(\gamma-1)(\gamma+2\delta ^2-1)}$$ (I think this is the correct branch for all $$\delta,\gamma$$).  Then the algorithm is just to take $$\theta\rightarrow\cos\theta=\delta\rightarrow t\rightarrow\vec\imath\rightarrow(\phi_i,\lambda_i)$$.  --Tardis (talk) 15:00, 3 November 2010 (UTC)
 * I can't find it in an article, but what I would do is:
 * * find the quaternion that rotates one vector to the other.
 * * convert it to axis-angle form (alternately you can derive the axis and angle directly, but this is I think is clearer)
 * * interpolate the angle from 0 to the angle calculated
 * * generate a quaternion from the axis and interpolated angle, and use this to rotate the first of the vectors (the one rotated from in the first step)
 * the vector will move linearly along the great circle, i.e. at a constant speed along the surface, as the angle is interpolated linearly. The conversions to and from axis angle are at Rotation representation (mathematics). I can't find anywhere that gives the rotation between two vectors as a quaternion, but it's a straightforward result. -- JohnBlackburne wordsdeeds 13:40, 3 November 2010 (UTC)

Begging the question and differentiating ex
Yesterday in class we were given a fairly simple assignment: show that $$\frac{d}{dx}e^x = e^x$$. This was supposed to illustrate something like the importance of rigourous proofs—the actual problem wasn't important and was in fact a problem from Calc 1. Oddly, a dispute arose over the problem nontheless. One of my classmates claimed that you can show $$\frac{d}{dx}e^x = e^x$$ by differentiating the Taylor series $$e^x = 1+x+\frac{x^2}{2}+\frac{x^3}{6}+ ...$$. I contested that this was begging the question because to know the Taylor series you have to know the derivative. She said that $$e^x$$ can be defined by its Taylor series, so this does not beg the question. Who is right? Thanks. —Preceding unsigned comment added by 24.92.78.167 (talk) 23:40, 3 November 2010 (UTC)
 * Hmm. It might be worth considering that you only need to know the derivative at $$x=a$$ to construct your Taylor series (in this case, $$a=0$$ and it's a Maclaurin series).  An alternative way to get to the derivative of $$e^x$$ at $$x=0$$ (like, say, the basic definition of e) would remove the circularity ... --86.130.152.0 (talk) 00:09, 4 November 2010 (UTC)
 * No, you need to know all derivatives (first, second, third, ...) of $$e^x$$ evaluated at x=0 to construct the MacLaurin series. However, I support 24.92's classmate: You certainly can take the MacLaurin series as the definition of $$e^x$$, and I think this approach is found in several complex analysis texts.  There are other reasonable options. You could define $$e^x$$ as the inverse of $$\ln(x):= \int_1^x \frac{1}{u} du$$; or you could define it as the unique function that is its own derivative and takes the value 1 at x=0.  (My calculus text offers a choice between these two presentations.)  Your assignment is ambiguous without a specified starting point, though presumably most people in the class knew what was expected.  (But it's always good to stop and think about the assumptions you're making.)  The fact that all of these approaches to defining $$e^x$$ are equivalent is a theorem, and your assignment was one step in the proof of that theorem. 140.114.81.55 (talk) 03:45, 4 November 2010 (UTC)
 * I'd agree with the OP in the sense that e^x's Maclaurin series was almost certainly a result of applying calculus to a different definition. That is, historically, the proof provided would very likely be circular. However, definitions can come out of thin air and if your class is using the Maclaurin series one the proof is correct for your purposes and not logically circular.


 * I really like the definition of the exponential function as the (unique) solution to the differential equation $$\frac{dy}{dx} = y, y(0) = 1$$ as mentioned above. Yet another definition could take $$e^{x+y} = e^x e^y, e^0 = (e^x)'(0) = 1$$ which gives your result directly from the definition of the derivative. 67.158.43.41 (talk) 05:30, 4 November 2010 (UTC)


 * Since I don't see it quoted above, I'd like to make reference to this article. Pallida  Mors  08:32, 4 November 2010 (UTC)