Putting Sharp Objects into Round Ones

Another week, another Riddler. This first question:

Choose three points on a circle at random and connect them to form a triangle. What is the probability that the center of the circle is contained in that triangle?

The method of finding if a point was in the center was as follows: Take Triangle ABC. Find the cross product of the vectors BA and BCenter. If the resulting vector is in the same direction (As measured by the dot product) as the cross product between the vectors BA and BC then the point is on the correct side of the line BA. Put another way, the center and the point C are on the same side of line AB. Repeat this for lines AC and BC. If the center is on the correct side of all the triangle’s lines then it is inside ABC.

This simulation was iterated to yield the answer of 25%.


Next question:

Choose four points at random (independently and uniformly distributed) on the surface of a sphere. What is the probability that the tetrahedron defined by those four points contains the center of the sphere?

This was much more tricky. Firstly we had to find four points randomly distributed on a sphere. For this I used the Marsaglia method detailed here:

If  x_1, x_2 are on independent uniform distributions on from (-1,1) and rejecting points for which x_1^2+x_2^2>=1

Capture.PNG

Next I needed to see if the center was enclosed. To do this I took the determinant 5 matrices of this form:

[[A_x,A_y,A_z,1],
[[B_x,B_y,B_z,1],
[[C_x,C_y,C_z,1],
[D_x,D_y,D_z,1]]
(Tetrahedron made up of points ABCD, center is c):

The other four matrices are of that form, but replacing A’s with c’s, then B’s with c’s, then C’s with c’s and finally D’s with c’s. If all these determinants have the same sign then the point is enclosed.

This simulation was iterated to yield the answer of 12.5%.

These graphs required a bunch of code to make the graphs. This can be found here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s