# Expectation of area of random projection [closed]

I am thinking about a solution with Mathematica of a problem from 14th Kolmogorov competition (2015) on probability

A planar polygon in three-dimensional space is projected onto a randomly chosen plane (i.e., the unit normal to the plane is uniformly distributed on the sphere). Find the mathematical expectation of the projection area if the area of the polygon equals $$S$$.

I find in WolframMathWorld a formula that describes a random point on the unit sphere TransformedDistribution[{x1/Sqrt[x1^2 + x2^2 + x3^2], x2/Sqrt[x1^2 + x2^2 + x3^2], x3/Sqrt[x1^2 + x2^2 + x3^2]}, {x1, x2, x3} \[Distributed] MultinormalDistribution[IdentityMatrix[3]]] and stuck here.

• @Downvoter: What is incorrect in my question? Commented May 22 at 15:54
• In the original answer by hand which I don't understand much the integral $$\frac 2 {4\pi} \int_0^{2\pi}\int_0^{\pi/2}\ \sin(\varphi)\cos(\varphi)\,d\varphi d\theta$$ is calculated. Commented May 22 at 16:15
• Boys who voted to close the question: "This question doesn’t meet a Mathematica Stack Exchange guideline". What does not meet this gideline? Commented May 23 at 16:39
• (-1) Almost all of your so-called problems are used to provoke fights instead of discussions. Commented May 24 at 13:21

numerical experiment:

Abs[Normalize[#][[3]]] & /@ RandomVariate[NormalDistribution[], {10^6, 3}] // Mean
(*    0.500006    *)


exact by using spherical coordinates: the projected area is $$S\cdot\left|\cos\theta\right|$$ and the average is $$\langle\left|\cos\theta\right|\rangle=\frac12$$:

Integrate[Abs[Cos[θ]] Sin[θ], {θ, 0, π}] / Integrate[Sin[θ], {θ, 0, π}]
(*    1/2    *)

• Solved ($1/2$): youtube.com/watch?v=ltLUadnCyi0 Commented May 22 at 15:19
• @DavidG.Stork: You are not right. A similar problem (the average of the random shadow of the cube) is solved on YouTube. The same questions arise: (i) "Why is the projected area equal to S⋅|cosθ| "? (ii) What is the sample space? Thank you anyway. Commented May 22 at 15:30
• Thank you. You mimic the answer done by hand which is too short. There are some moments I don't understand: (i) Can you elaborate your "the projected area is S⋅|cosθ| "? (ii) How do you calculate the average? What is the sample space? TIA. Commented May 22 at 15:32
• The area of the shadow/projection is $\cos\theta$ because it's the only spherical harmonic that makes sense. Think of it in terms of the Lie group of 3D rotations and what has to happen to the projection as you rotate the plane. Then, consider only the magnitude $\left|\cos\theta\right|$ because we don't care about the sign of the shadow projection. But there's not enough space here for an elementary introduction to 3D geometry. Commented May 22 at 19:52
• You already know what you want and expect someone to deliver exactly what you want? That's not going to work in life. You need to show effort in trying to understand what others offer. Commented May 23 at 7:24

On the same web Sphere Point Picking as in OP there is also formula for random point on a sphere in spherical coordinates (with error of swapping $$\theta$$ and $$\phi$$ which I corrected).

Then it is really simple if we use the fact stated in answer by @Roman that projected area is equal to $$S\cdot\left|\cos\theta\right|$$.

{r, theta, phi} = {1, ArcCos[2 v - 1], 2 Pi u};

Expectation[
Abs[Cos[theta]], {u \[Distributed] UniformDistribution[],
v \[Distributed] UniformDistribution[]}]

(*simplified version*)
Expectation[Abs[2 v - 1], v \[Distributed] UniformDistribution[]]

Clear[r, theta, phi]


1/2

1/2

• Thank you for your work. Can you give a solid accessible reference to "the fact stated in answer by @Roman that projected area is equal to $S|\cos(\theta)|$"? What is denoted by $\theta$? What is/are the sample space/spaces in your calculations? Did you pay your attention to my comment to my question with the formula from the original answer? Commented May 22 at 18:33
• @user64494 Theta is angle between positive z axis and normal vector to the surface of polygon being projected to xy plane. Commented May 22 at 18:38
• Thank you. I repeat my requests about the reference and sample spaces. Commented May 22 at 18:47

To long to be a comment under Roman's answer: the numerical experiment can be carried out by RandomPoint to get faster random point generating in unit sphere, just like RandomPoint[Sphere[], 10^6].

RandomPoint[Sphere[], 10^6][[All, 3]] // Abs // Mean // AbsoluteTiming

(*{0.066198, 0.500014}*)

Abs[Normalize[#][[3]]] & /@
RandomVariate[NormalDistribution[], {10^6, 3}] //
Mean // AbsoluteTiming

(*{0.66592, 0.50007}*)


Ten-times faster in my machine.

• This is a comment, not an answer, and could be presented as a comment. Commented May 23 at 13:25
• Not too long for a comment.T o long to be a comment under Roman's answer: the numerical experiment can be carried out by RandomPoint to get faster random point generating in unit sphere, just like RandomPoint[Sphere[], 10^6]. RandomPoint[Sphere[], 10^6][[All, 3]] // Abs // Mean // AbsoluteTiming ({0.066198, 0.500014}) Abs[Normalize[#][[3]]] & /@ RandomVariate[NormalDistribution[], {10^6, 3}] // Mean // AbsoluteTiming ({0.66592, 0.50007}) Commented May 23 at 15:52

Here is my answer to my question. First, the formula $$S*|\cos(\theta)|$$ is derived with Mathematica. Without loss of the generality, we may assume that a planar polygon is a triangle Triangle[{{x1, y1, 0}, {x2, y2, 0}, {x3, y3, 0}}]in the plane $$xOy$$ with

 Area[Triangle[{{x1, y1, 0}, {x2, y2, 0}, {x3, y3, 0}}]]


1/2 Sqrt[(-x2 y1 + x3 y1 + x1 y2 - x3 y2 - x1 y3 + x2 y3)^2]

Now we consider the plane in the three-dimensional space with normal {Cos[\[Alpha]], Cos[\[Beta]], Cos[\[Theta]]} passing through the origin

h = Hyperplane[{Cos[\[Alpha]], Cos[\[Beta]], Cos[\[Theta]]}, 0];


and find the projections of the vertices of the triangle onto this plane. For example,

RegionNearest[h, {x1, y1, 0}]


{x1 - (Cos[\[Alpha]] (x1 Cos[\[Alpha]] + y1 Cos[\[Beta]]))/( Cos[\[Alpha]]^2 + Cos[\[Beta]]^2 + Cos[\[Theta]]^2), y1 - (Cos[\[Beta]] (x1 Cos[\[Alpha]] + y1 Cos[\[Beta]]))/( Cos[\[Alpha]]^2 + Cos[\[Beta]]^2 + Cos[\[Theta]]^2), -(((x1 Cos[\[Alpha]] + y1 Cos[\[Beta]]) Cos[\[Theta]])/( Cos[\[Alpha]]^2 + Cos[\[Beta]]^2 + Cos[\[Theta]]^2))}

At last,

FullSimplify[Area[Triangle[{RegionNearest[h, {x1, y1, 0}],
RegionNearest[h, {x2, y2, 0}], RegionNearest[h, {x3, y3, 0}]}]]/
Area[Triangle[{{x1, y1, 0}, {x2, y2, 0}, {x3, y3, 0}}]],
Assumptions ->  Cos[\[Alpha]]^2 + Cos[\[Beta]]^2 + Cos[\[Theta]]^2 == 1 && \[Theta] \[Element] Reals]


Abs[Cos[\[Theta]]]

finishes the work.

Now we realize the approach with normal distributions

ToSphericalCoordinates[{x1/Sqrt[x1^2 + x2^2 + x3^2],
x2/Sqrt[x1^2 + x2^2 + x3^2],  x3/Sqrt[x1^2 + x2^2 + x3^2]}] // Simplify


{1, ArcTan[x3/Sqrt[x1^2 + x2^2 + x3^2], Sqrt[(x1^2 + x2^2)/( x1^2 + x2^2 + x3^2)]], ArcTan[x1/Sqrt[x1^2 + x2^2 + x3^2], x2/Sqrt[x1^2 + x2^2 + x3^2]]}

FullSimplify[Cos[ArcTan[x3/Sqrt[x1^2 + x2^2 + x3^2],
Sqrt[(x1^2 + x2^2)/(x1^2 + x2^2 + x3^2)]]]]


x3/Sqrt[x1^2 + x2^2 + x3^2]

z = TransformedDistribution[ x3/Sqrt[x1^2 + x2^2 + x3^2],
{x1, x2, x3} \[Distributed] MultinormalDistribution[IdentityMatrix[3]]]


UniformDistribution[{-1, 1}]

The last step is

Mean[TransformedDistribution[RealAbs[z],
z \[Distributed] UniformDistribution[{-1, 1}]]]


1/2

• What is incorrect in my answer? It is unfair to down vote without any explanatory comment. Commented May 23 at 13:20
• (-1)_Please elaboard that may assume that a planar polygon is a triangle` Commented May 24 at 13:05