karthickgururaj Posted October 1, 2014 Report Share Posted October 1, 2014 Pick three points on a plane at random (assume uniform probability density across the plane). What is the probability that the triangle so formed is obtuse angled? Source: general internet, with some slight changes. I got a surprising answer to this one.. 1 Quote Link to comment Share on other sites More sharing options...
0 koren Posted October 8, 2014 Report Share Posted October 8, 2014 (edited) Pick three points on a plane at random (assume uniform probability density across the plane). What is the probability that the triangle so formed is obtuse angled? Source: general internet, with some slight changes. I got a surprising answer to this one.. I suggest, we construct a kind of "triangles generator": We take a circle of any diameter, draw a chord AC from the endpoints of the chord we draw two line segments, the ends of which intersect on the circle. Symmetrically we draw two other segments on the other side of the chord and we got two triangles. When the chord is coincides with diameter the triangles are identical. The final touch – we connect the vertices of the triangles by line a-a. "Triangles generator" is ready let's start generate. For this purpose we are doing two things: 1) Moving the chord parallel to itself from the diameter stepwise with any resolution you choose. 2) At each step we move the line a-a together with the vertices of the triangles from point B to point A. By action 1 we iterate through all possible angles at the vertices of the triangles. (Look at nice animation here) By action 2 - iterate through all possible conjugate base angles. Eventually we generate all possible variants of triangles. At the resolution tending to zero we get close to infinite number of triangles, but an interesting observation for us, that in any case each specific obtuse triangle always has one corresponding acute-angled triangle. In other words: THE PROBABILITY OBTAIN OBTUSE TRIANGLE AT RANDOM CHOICE IS 50%. Edited October 8, 2014 by koren Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 8, 2014 Report Share Posted October 8, 2014 (edited) I think the probability of triangle being obtuse is near 1 for an infinite plane Choose any 2 points shown with the blue line below; Now, as long as the third point is within the two red lines, the triangle is acute otherwise obtuse For an infinte plance, the probability of third point within these two lines is near zero. Sans titre.JPG The flaw here is saying the first two points have a finite separation. Only then does the strip occupy 0% of the plane. You can choose any single point and call it the origin. But any other point freely chosen on the plane will be infinitely far away. Saying it another way, any other freely chosen point will have a finite separation from the first point with probability zero. Edit: This observation applies also to karthickgururaj's post #11 and following posts that discuss it. Edited October 8, 2014 by bonanova Added comment Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 8, 2014 Report Share Posted October 8, 2014 Pick three points on a plane at random (assume uniform probability density across the plane). What is the probability that the triangle so formed is obtuse angled? Source: general internet, with some slight changes. I got a surprising answer to this one.. I suggest, we construct a kind of "triangles generator": We take a circle of any diameter, draw a chord AC from the endpoints of the chord we draw two line segments, the ends of which intersect on the circle. Symmetrically we draw two other segments on the other side of the chord and we got two triangles. When the chord is coincides with diameter the triangles are identical. The final touch – we connect the vertices of the triangles by line a-a. "Triangles generator" is ready let's start generate. For this purpose we are doing two things: 1) Moving the chord parallel to itself from the diameter stepwise with any resolution you choose. 2) At each step we move the line a-a together with the vertices of the triangles from point B to point A. By action 1 we iterate through all possible angles at the vertices of the triangles. (Look at nice animation here) By action 2 - iterate through all possible conjugate base angles. Eventually we generate all possible variants of triangles. At the resolution tending to zero we get close to infinite number of triangles, but an interesting observation for us, that in any case each specific obtuse triangle always has one corresponding acute-angled triangle. In other words: THE PROBABILITY OBTAIN OBTUSE TRIANGLE AT RANDOM CHOICE IS 50%. One must be careful when defining random triangles. There are many ways, yielding various distributions. The OP requires a particular method: selecting three points at random. This is easily done (for the unit circle) by selecting x and y values in the closed interval [-1, 1] and discarding any points for which x2+ y2>1. Inspecting a million or so triangles constructed from triplets of such points gives a clear answer to the probability in a finite region. Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 8, 2014 Report Share Posted October 8, 2014 seems to me every triangle will have a greatest angle between 60 and 180 degrees and cant see how any of those would be more likely than another so three quarters of those will have a greatest angle greater than 90 degrees? Does the greatest angle (of triangles constructed from three random points) actually have a uniform distribution over the range [60o, 180o]? I can't think of an immediate proof. That doesn't mean there is no proof. But perhaps it is the case. And it does lead to (what I believe is) the correct answer. Nice approach! Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 8, 2014 Report Share Posted October 8, 2014 My take: [spoiler='Quick and dirty answer for finite circle']Place any three points A B and C in a unit (or any finite radius) circle. We prohibit ABC from all lying on a straight line. This is OK, because such configurations constitute 0% of all cases. Construct the points A' B' and C' so that the centers of the line segments AA', BB' and CC' lie on the origin. Inspect the eight triangles ABC, A'BC, AB'C, ABC', A'B'C, A'BC', AB'C' and A'B'C'. In every case exactly six of the eight triangles are obtuse. The probability of an obtuse triangle in a finite circle is 0.75. --------- What is the probability that a random triangle inside a circle covers its center?Examine the same eight triangles! If the OP has a solution, it is the same as for a circle of finite radius. Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 8, 2014 Report Share Posted October 8, 2014 Is there any reason why my argument above that the probability is 3/4 is incorrect? For that matter, is there any reason why the following argument that the probability is about 64% is incorrect? Are they ALL correct?!? Define A and B as the two points that are farthest apart out of A, B, and C. Also, without loss of generality, define your coordinate system such that A is at (0, 0) and B is at (1, 0). Since the distance from A to C and the distance from B to C are each less than the distance from A to B, you can draw circles of radius 1 around points A and B, and point C must lie within the overlap of those circles. In the figure below, it would fall somewhere in either the red or blue areas. That total area is 2*pi/3 - sqrt(3)/2 = (4*pi - 3*sqrt(3)) / 6 (reference: http://math.stackexchange.com/questions/402858/area-of-intersection-between-two-circles) If point C lies within the blue circle then angle A-C-B would be obtuse. Otherwise all three angles would be acute. The blue circle has radius 1/2, so its area is pi/4. The probability that triangle ABC is obtuse is equal to the blue area divided by the blue plus red areas, = [pi/4] / [(4*pi - 3*sqrt(3)) / 6] = 3*pi / [8*pi - 6*sqrt(3)] approximately 0.64, or 64% circle overlap.jpg Assume we're analyzing a finite area, else AB would be infinite. By limiting the third point to the blue and red regions we no longer have three points uniformly chosen from within a circle. Another way of saying this is if the third point roams over a circular field, then in some cases the longest side will not be AB. Constraining AB to be the longest side precludes having triangles constructed from three uniformly chosen points. We're analyzing results from a particular subset of the entire ensemble of triangles prescribed by the OP. Since we have not shown that the subset is representative, we're open to bias in the result. That will preclude representing the plane by letting AB go to infinity. Quote Link to comment Share on other sites More sharing options...
0 plasmid Posted October 9, 2014 Report Share Posted October 9, 2014 (edited) I'm not sure I follow. If you pick any three points randomly (keeping it in a finite area to make things comprehensible) and call them X, Y, and Z, then one of the three sides XY, YZ, or ZX must be the longest, and you can relabel the points so that the longest side has points A and B and make the leftover point be C. The points were all uniformly chosen in whatever area was available; the limitation of where point C could lie purely stems from having labeled A and B as the termini of the longest edge. Put another way: point C could fall outside the red and blue areas, but if it did then you would just relabel the points so it's no longer labeled C. I really do think the answer is probably 75% instead of 64%, but I'm not completely sure what the hole in the 64% argument is. I get the feeling that there's something subtle going on that makes the probability distribution of point C within the red and blue regions become non-uniform and denser in the blue region, but I can't tell exactly what it is. Edit: Plus, Java is telling me that it's about 72.5% It's seldom that I favor theory over experiment, but in this case I still think 75% is more likely correct. package obtuse; import java.util.*; class Triangle { /* Contains x and y coordinates of the three points of the triangle in * variables x[0], y[0]; x[1], y[1]; x[2], y[2] */ double[] x, y; public Triangle() { /* Picks the three points of the triangle randomly from the unit square */ x = new double[3]; y = new double[3]; Random rand = new Random(); for(int i=0; i<3; i++) { x[i] = rand.nextDouble(); y[i] = rand.nextDouble(); } } public boolean checkObtuse() { /* This calculates the dot product of each pair of vectors from each * vertex and sees if any of them are negative, which would indicate * an obtuse angle. */ boolean obtuse; obtuse = (((x[1]-x[0])*(x[2]-x[0]) + (y[1]-y[0])*(y[2]-y[0])) < 0) || (((x[0]-x[1])*(x[2]-x[1]) + (y[0]-y[1])*(y[2]-y[1])) < 0) || (((x[0]-x[2])*(x[1]-x[2]) + (y[0]-y[2])*(y[1]-y[2])) < 0); return obtuse; } } public class Obtuse{ public static void main(String[] args){ int iters = 100000; int obtuse = 0; Triangle myTriangle; for (int i=0; i<iters; i++){ myTriangle = new Triangle(); if(myTriangle.checkObtuse()) { obtuse++; } } System.out.println((double)obtuse/iters); } } Edited October 9, 2014 by plasmid Quote Link to comment Share on other sites More sharing options...
0 karthickgururaj Posted October 9, 2014 Author Report Share Posted October 9, 2014 My take: [spoiler='Quick and dirty answer for finite circle']Place any three points A B and C in a unit (or any finite radius) circle. We prohibit ABC from all lying on a straight line. This is OK, because such configurations constitute 0% of all cases. Construct the points A' B' and C' so that the centers of the line segments AA', BB' and CC' lie on the origin. Inspect the eight triangles ABC, A'BC, AB'C, ABC', A'B'C, A'BC', AB'C' and A'B'C'. In every case exactly six of the eight triangles are obtuse. The probability of an obtuse triangle in a finite circle is 0.75. --------- What is the probability that a random triangle inside a circle covers its center?Examine the same eight triangles! If the OP has a solution, it is the same as for a circle of finite radius. Very clever! Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 9, 2014 Report Share Posted October 9, 2014 @plas, The procedure loses track of some constraints on C. ABC originate from a circle. AB is found to be the largest segment. Red and blue areas are then constructed on AB. C is then allowed to roam over the colored areas. In 64% of those cases the triangle is obtuse. In the picture of red and blue areas (3), the selection circle (1) is not shown. For some AB, parts of the colored area can lie outside the selection circle. The more likely color to lie outside is red, since the blue area is more central. Reducing red relative to blue increases the obtuse percentage. If this effect is averaged over all cases of AB, 64% might well converge to 75%. Take an extreme example where AB is a diameter of the selection circle. In this case the available red area vanishes, increasing the obtuse probability to 100%. Quote Link to comment Share on other sites More sharing options...
0 plasmid Posted October 9, 2014 Report Share Posted October 9, 2014 (edited) That's a good point that arises when the available area becomes finite, and it seems very difficult to quantify that effect. And now Perl is agreeing with Java that the answer is about 72.5% if you pick points from a unit square. The code is so short that there doesn't seem to be much of a place for bugs to hide, and like the Java code it just depends on dot products which seem fairly straightforward. #!/usr/bin/perl use strict; use warnings; my $obtuses = 0; my $iterations = 100000; my @x = (); my @y = (); for(my $i=0; $i<$iterations; $i++) { for(my $j=0; $j<3; $j++) { $x[$j] = rand(); $y[$j] = rand(); } $obtuses += ((($x[1]-$x[0])*($x[2]-$x[0]) + ($y[1]-$y[0])*($y[2]-$y[0])) < 0); $obtuses += ((($x[0]-$x[1])*($x[2]-$x[1]) + ($y[0]-$y[1])*($y[2]-$y[1])) < 0); $obtuses += ((($x[0]-$x[2])*($x[1]-$x[2]) + ($y[0]-$y[2])*($y[1]-$y[2])) < 0); } print "There were $obtuses obtuse triangles out of $iterations tested"; Edit: It might be that the shape from which the points were selected impacts the probability that they form an obtuse triangle. And if that's the case, it's probably impossible to say what to expect if the three points are chosen from an infinite plane without boundaries -- were they drawn from an an infinitely large square with probability 72.5% or an infinitely large circle with probability 75%? Edited October 9, 2014 by plasmid Quote Link to comment Share on other sites More sharing options...
0 karthickgururaj Posted October 9, 2014 Author Report Share Posted October 9, 2014 That's a good point that arises when the available area becomes finite, and it seems very difficult to quantify that effect. And now Perl is agreeing with Java that the answer is about 72.5% if you pick points from a unit square. The code is so short that there doesn't seem to be much of a place for bugs to hide, and like the Java code it just depends on dot products which seem fairly straightforward. #!/usr/bin/perl use strict; use warnings; my $obtuses = 0; my $iterations = 100000; my @x = (); my @y = (); for(my $i=0; $i<$iterations; $i++) { for(my $j=0; $j<3; $j++) { $x[$j] = rand(); $y[$j] = rand(); } $obtuses += ((($x[1]-$x[0])*($x[2]-$x[0]) + ($y[1]-$y[0])*($y[2]-$y[0])) < 0); $obtuses += ((($x[0]-$x[1])*($x[2]-$x[1]) + ($y[0]-$y[1])*($y[2]-$y[1])) < 0); $obtuses += ((($x[0]-$x[2])*($x[1]-$x[2]) + ($y[0]-$y[2])*($y[1]-$y[2])) < 0); } print "There were $obtuses obtuse triangles out of $iterations tested"; Edit: It might be that the shape from which the points were selected impacts the probability that they form an obtuse triangle. And if that's the case, it's probably impossible to say what to expect if the three points are chosen from an infinite plane without boundaries -- were they drawn from an an infinitely large square with probability 72.5% or an infinitely large circle with probability 75%? The shape will definitely affect the probability! But in this question a circle is chosen, please see my response to bonanova's response (the third response, on the first page): A uniform probability density function across an infinite domain is zero everywhere. To see this, first choose an origin. Then the likelihood of three randomly chosen points lying within a circle of finite radius is zero. That's because the area ratio of any finite circle and the entire plane is zero. So, with probability one any randomly chosen point in the plane lies at infinity, where angles are not defined. So the question can only be answered for a finite portion of the plane, for example by choosing points at random within a circle of finite radius. Since that result does not depend on radius, one can then argue that the finite result holds on the plane and that the answer solves the OP. For finite circular domains, obtuse triangles are more plentiful than acute ones, but I'll leave the exact ratio for another to find. I agree we need to assume the points to be contained in a finite circle, and then apply the limit as the radius approaches infinity. The question can be considered suitable re-worded. [spoiler=Why circle, and not any other shape?.. ] ..because a circle is "fair" Fairness was implicit in the question. It is like asking: a point is chosen at random on x-axis, what is the probability that it is positive? "Intuitively", it looks to be 0.5. But we can get to that result only if we assume a line segment centered at origin, and then apply the limit as the segment length approaches infinity. A line segment centered at origin is "fair" to both positive and negative directions. I solved the puzzle in a slightly different way (however..), without starting with a bounding circle. I'll post that solution later, not sure if it is entirely correct. Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 9, 2014 Report Share Posted October 9, 2014 That's a good point that arises when the available area becomes finite, The procedure can only be done for finite area. Remember AB was mapped to (0,0)(1,0). If we start with an infinite selection circle, then with probability 1 AB is infinite -- precluding the drawing of red and blue stuff. In all cases we first get a result for a finite-r selection circle then get to the plane by extending r to infinity. You can simulate the unit circle exactly in Perl. Just ignore selected points for which x2+y2>1. The result should be 75% Quote Link to comment Share on other sites More sharing options...
0 koren Posted October 9, 2014 Report Share Posted October 9, 2014 Pick three points on a plane at random (assume uniform probability density across the plane). What is the probability that the triangle so formed is obtuse angled? Source: general internet, with some slight changes. I got a surprising answer to this one.. I suggest, we construct a kind of "triangles generator": We take a circle of any diameter, draw a chord AC from the endpoints of the chord we draw two line segments, the ends of which intersect on the circle. Symmetrically we draw two other segments on the other side of the chord and we got two triangles. When the chord is coincides with diameter the triangles are identical. The final touch – we connect the vertices of the triangles by line a-a. "Triangles generator" is ready let's start generate. For this purpose we are doing two things: 1) Moving the chord parallel to itself from the diameter stepwise with any resolution you choose. 2) At each step we move the line a-a together with the vertices of the triangles from point B to point A. By action 1 we iterate through all possible angles at the vertices of the triangles. (Look at nice animation here) By action 2 - iterate through all possible conjugate base angles. Eventually we generate all possible variants of triangles. At the resolution tending to zero we get close to infinite number of triangles, but an interesting observation for us, that in any case each specific obtuse triangle always has one corresponding acute-angled triangle. In other words: THE PROBABILITY OBTAIN OBTUSE TRIANGLE AT RANDOM CHOICE IS 50%. One must be careful when defining random triangles. There are many ways, yielding various distributions. The OP requires a particular method: selecting three points at random. = which means choose random triangle = This is easily done (for the unit circle) by selecting x and y values in the closed interval [-1, 1] and discarding any points for which x2+ y2>1. Inspecting a million or so triangles constructed from triplets of such points gives a clear answer to the probability in a finite region., Please pay attention - I prove clearly that any obtuse triangle corresponds to one of the acute-angled, which shows clearly that we have 50% chance to choose one or the type no matter in which way you do it. 1 Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 9, 2014 Report Share Posted October 9, 2014 @koren, your triangle generator is different from picking three points, and that is why your answer differs from results posted here by others. You may be familiar with the Bertrand paradox, in which "random" chords lead to at least three different results, or you may not. If an uncertain definition of "random" is something you've not thought of, you might Google "Bertrand paradox" and enjoy a really mind bending example of it. Sometimes running a simulation is a convenient way to confirm a particular calculated or constructed result. Writing a program forces one to obey the constraints of the OP and think carefully through the analysis. There is an interesting irony in the fact that while your post does not answer to the conditions of the OP, its tone does answer somewhat to its title. You will find that most people here try quite hard to pay attention. In the process, we all learn things from time to time. Quote Link to comment Share on other sites More sharing options...
0 plasmid Posted October 9, 2014 Report Share Posted October 9, 2014 (edited) Sure enough, when I modified the Java code to also calculate the probability of a triangle drawn from a unit circle to be obtuse, it wasn't ~72.5% like a unit square. It was ~72%. Gyah. package obtuse; import java.util.*; class Triangle { /* Contains x and y coordinates of the three points of the triangle in * variables x[0], y[0]; x[1], y[1]; x[2], y[2] */ double[] x, y; public Triangle(String shape) { /* Picks the three points of the triangle randomly from the unit square * or unit circle */ x = new double[3]; y = new double[3]; Random rand = new Random(); switch (shape) { case "UnitSquare": for(int i=0; i<3; i++) { x[i] = rand.nextDouble(); y[i] = rand.nextDouble(); } break; case "UnitCircle": for(int i=0; i<3; i++) { do { x[i] = 2 * rand.nextDouble() - 1; y[i] = 2 * rand.nextDouble() - 1; } while (Math.sqrt(x[i]*x[i] + y[i]*y[i]) > 1); } break; } } public boolean checkObtuse() { /* This calculates the dot product of each pair of vectors from each * vertex and sees if any of them are negative, which would indicate * an obtuse angle. */ boolean obtuse; obtuse = (((x[1]-x[0])*(x[2]-x[0]) + (y[1]-y[0])*(y[2]-y[0])) < 0) || (((x[0]-x[1])*(x[2]-x[1]) + (y[0]-y[1])*(y[2]-y[1])) < 0) || (((x[0]-x[2])*(x[1]-x[2]) + (y[0]-y[2])*(y[1]-y[2])) < 0); return obtuse; } } public class Obtuse{ public static void main(String[] args){ int iters = 100000; int obtuseSquare = 0; int obtuseCircle = 0; Triangle myTriangle; for (int i=0; i<iters; i++){ myTriangle = new Triangle("UnitSquare"); if(myTriangle.checkObtuse()) { obtuseSquare++; } myTriangle = new Triangle("UnitCircle"); if(myTriangle.checkObtuse()) { obtuseCircle++; } } System.out.printf("%d unit square and %d unit circle", obtuseSquare, obtuseCircle); System.out.printf(" triangles out of %d trials were obtuse.\n", iters); } } Edited October 9, 2014 by plasmid Quote Link to comment Share on other sites More sharing options...
0 plasmid Posted October 9, 2014 Report Share Posted October 9, 2014 I'm not sure why the post gets messed up when I try to quote Bonanova's argument, but I can't quote it without wrecking its formatting.Triangle ABC is roughly equilateral, and point C is very close to the origin.ABC - acuteABC' - acuteAB'C - obtuseAB'C' - obtuseA'BC - obtuseA'BC' - obtuseA'B'C - acuteA'B'C' - acute Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 9, 2014 Report Share Posted October 9, 2014 Does this line of code for UnitCircle while (Math.sqrt(x[i]*x[i] + y[i]*y[i]) > 1); use the square corners, or ignore them? Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 9, 2014 Report Share Posted October 9, 2014 (edited) I'm not sure why the post gets messed up when I try to quote Bonanova's argument, but I can't quote it without wrecking its formatting. Triangle ABC is roughly equilateral, and point C is very close to the origin. ABC - acute ABC' - acute AB'C - obtuse AB'C' - obtuse A'BC - obtuse A'BC' - obtuse A'B'C - acute A'B'C' - acuteTriangles in circle.jpg Wow. Good catch. I wish my simulation computer were running. I would love to play more with this. I haven't found any reputable (e.g. Wolfram) derivations of this probability. There are several derivations for 75% if the points are on (not inside) the circle. That is, for three random points on the circumference, p(acute) = .25; p(obtuse) = .75. Edit: This construction makes pairs of triangles (e.g. ABC and A'B'C') that are congruent. So of the 8 triangles, exactly 0, 2, 4, 6, or 8 are acute with the others being obtuse. I thought the distribution in every case was 6/2 (obtuse/acute). You show a 4/4 case. I wonder whether it's ever 8/0. Or 2/6. Edited October 9, 2014 by bonanova Added thought Quote Link to comment Share on other sites More sharing options...
0 karthickgururaj Posted October 9, 2014 Author Report Share Posted October 9, 2014 Sure enough, when I modified the Java code to also calculate the probability of a triangle drawn from a unit circle to be obtuse, it wasn't ~72.5% like a unit square. It was ~72%. Gyah. package obtuse; import java.util.*; class Triangle { /* Contains x and y coordinates of the three points of the triangle in * variables x[0], y[0]; x[1], y[1]; x[2], y[2] */ double[] x, y; public Triangle(String shape) { /* Picks the three points of the triangle randomly from the unit square * or unit circle */ x = new double[3]; y = new double[3]; Random rand = new Random(); switch (shape) { case "UnitSquare": for(int i=0; i<3; i++) { x[i] = rand.nextDouble(); y[i] = rand.nextDouble(); } break; case "UnitCircle": for(int i=0; i<3; i++) { do { x[i] = 2 * rand.nextDouble() - 1; y[i] = 2 * rand.nextDouble() - 1; } while (Math.sqrt(x[i]*x[i] + y[i]*y[i]) > 1); } break; } } public boolean checkObtuse() { /* This calculates the dot product of each pair of vectors from each * vertex and sees if any of them are negative, which would indicate * an obtuse angle. */ boolean obtuse; obtuse = (((x[1]-x[0])*(x[2]-x[0]) + (y[1]-y[0])*(y[2]-y[0])) < 0) || (((x[0]-x[1])*(x[2]-x[1]) + (y[0]-y[1])*(y[2]-y[1])) < 0) || (((x[0]-x[2])*(x[1]-x[2]) + (y[0]-y[2])*(y[1]-y[2])) < 0); return obtuse; } } public class Obtuse{ public static void main(String[] args){ int iters = 100000; int obtuseSquare = 0; int obtuseCircle = 0; Triangle myTriangle; for (int i=0; i<iters; i++){ myTriangle = new Triangle("UnitSquare"); if(myTriangle.checkObtuse()) { obtuseSquare++; } myTriangle = new Triangle("UnitCircle"); if(myTriangle.checkObtuse()) { obtuseCircle++; } } System.out.printf("%d unit square and %d unit circle", obtuseSquare, obtuseCircle); System.out.printf(" triangles out of %d trials were obtuse.\n", iters); } } Just a suggestion: since we do not really know if rand(..) is going to yield well-distributed points, it may make more sense to just just step x and y linearly over small increments. Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 9, 2014 Report Share Posted October 9, 2014 @koren, follow-up: a straightforward calculation shows p(obtuse) = 3/4 for random point triplets taken from the perimeter. If including interior points made p(obtuse) jump discontinuously to 1/2, it would be a tremendously interesting result. Don't you agree? Quote Link to comment Share on other sites More sharing options...
0 plasmid Posted October 10, 2014 Report Share Posted October 10, 2014 (edited) Does this line of code for UnitCirclewhile (Math.sqrt(x*x + y*y) > 1);use the square corners, or ignore them?It omits the corners. The "while" statement is part of a "do ... while" loop surrounding the code that selects random numbers for x and y, so it keeps "do"-ing the loop "while" x2 + y2 > 1 and it stops generating new random numbers once it reaches a value that's not >1. Sure enough, when I modified the Java code to also calculate the probability of a triangle drawn from a unit circle to be obtuse, it wasn't ~72.5% like a unit square. It was ~72%. Gyah. package obtuse; import java.util.*; class Triangle { /* Contains x and y coordinates of the three points of the triangle in * variables x[0], y[0]; x[1], y[1]; x[2], y[2] */ double[] x, y; public Triangle(String shape) { /* Picks the three points of the triangle randomly from the unit square * or unit circle */ x = new double[3]; y = new double[3]; Random rand = new Random(); switch (shape) { case "UnitSquare": for(int i=0; i<3; i++) { x[i] = rand.nextDouble(); y[i] = rand.nextDouble(); } break; case "UnitCircle": for(int i=0; i<3; i++) { do { x[i] = 2 * rand.nextDouble() - 1; y[i] = 2 * rand.nextDouble() - 1; } while (Math.sqrt(x[i]*x[i] + y[i]*y[i]) > 1); } break; } } public boolean checkObtuse() { /* This calculates the dot product of each pair of vectors from each * vertex and sees if any of them are negative, which would indicate * an obtuse angle. */ boolean obtuse; obtuse = (((x[1]-x[0])*(x[2]-x[0]) + (y[1]-y[0])*(y[2]-y[0])) < 0) || (((x[0]-x[1])*(x[2]-x[1]) + (y[0]-y[1])*(y[2]-y[1])) < 0) || (((x[0]-x[2])*(x[1]-x[2]) + (y[0]-y[2])*(y[1]-y[2])) < 0); return obtuse; } } public class Obtuse{ public static void main(String[] args){ int iters = 100000; int obtuseSquare = 0; int obtuseCircle = 0; Triangle myTriangle; for (int i=0; i<iters; i++){ myTriangle = new Triangle("UnitSquare"); if(myTriangle.checkObtuse()) { obtuseSquare++; } myTriangle = new Triangle("UnitCircle"); if(myTriangle.checkObtuse()) { obtuseCircle++; } } System.out.printf("%d unit square and %d unit circle", obtuseSquare, obtuseCircle); System.out.printf(" triangles out of %d trials were obtuse.\n", iters); } }Just a suggestion: since we do not really know if rand(..) is going to yield well-distributed points, it may make more sense to just just step x and y linearly over small increments.Ok, I could do that after I get home from work.Edit: OK, I did that and still got the same answer: 72.5% for a square and 72% for a circle. Edited October 10, 2014 by plasmid Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 10, 2014 Report Share Posted October 10, 2014 @plas Thanks for the expl -- I was grasping at straws. Your ABCA'B'C' example where acute=obtuse=4 has me thinking: I think those cases are few, I think the acute=2 obtuse=6 cases are plenteous, and I don't think other cases are possible. If that mix is representative, it can be consistent with the simulated 72%. It's intuitive to me that a square could be slightly more accommodating of obtuse triangles. I can't seem to get my old simulation computer (Vista) fixed. I might get sufficiently motivated by problems like this to learn Perl. @karthickgururaj, probably good to check rand, but I wouldn't have expected deviations at that level to produce a systematic bias in the result. This check should put the worry to bed for other simulations.. Quote Link to comment Share on other sites More sharing options...
0 k-man Posted October 10, 2014 Report Share Posted October 10, 2014 here is an example of 2/6 ratio. Only ABC' and A'B'C triangles are obtuse. Others are acute. Quote Link to comment Share on other sites More sharing options...
0 bonanova Posted October 10, 2014 Report Share Posted October 10, 2014 here is an example of 2/6 ratio. Only ABC' and A'B'C triangles are obtuse. Others are acute.obtuse.png Wow thanks k-man. Since it's very unlikely that 0/8 or 8/0 cases exist, 6/2 with p(obtuse) = 3/4 looks like the highest case, with a smattering of lower cases dragging the overall average down a bit. This gives great credence to plasmid's simulations, and probably puts this puzzle to bed. I'm looking at an approach that WOLOG places A on a radius at 12:00 (r, 0) where 0<r<1 and calculates plasmid's red and blue areas (from a few posts back) that lie inside the selection circle for a given B. Averaging or integrating over all B locations in the selection circle will then give the answer. If analytical expressions for red and blue areas can be found, then integration gives an exact answer (but that looks hard.) else, numerically calculating and averaging red and blue for B on a grid of points will give an approximate answer that can be refined by tightening the grid. But that looks hard also. This has been an interesting problem. I'm going to give it my rating point. Quote Link to comment Share on other sites More sharing options...
0 gavinksong Posted October 15, 2014 Report Share Posted October 15, 2014 (edited) Ohhhhhh, this one is weird. I didn't read the thread for this one, so forgive me if I am redundant, but here are my thoughts... After choosing the first two points, there's three cases that would result in an obtuse triangle. One, the third point is not "between" the first two points. Two, the third point is within the circle whose diameter is the line segment between the first two points. Sooooooo, technically this area is infinite, but so is the remainder of the plane... However, the "obtuse" territory expands infinitely along two axes while the "acute" territory expands infinitely along one axis, so I would be tempted to say that the probability of an obtuse triangle is 1. That's my amateur take on it anyways. Edited October 15, 2014 by gavinksong Quote Link to comment Share on other sites More sharing options...
Question
karthickgururaj
Pick three points on a plane at random (assume uniform probability density across the plane). What is the probability that the triangle so formed is obtuse angled?
Source: general internet, with some slight changes.
I got a surprising answer to this one..
Link to comment
Share on other sites
Top Posters For This Question
15
13
12
7
Popular Days
Oct 9
13
Oct 3
7
Oct 8
6
Oct 6
5
Top Posters For This Question
bonanova 15 posts
karthickgururaj 13 posts
plasmid 12 posts
koren 7 posts
Popular Days
Oct 9 2014
13 posts
Oct 3 2014
7 posts
Oct 8 2014
6 posts
Oct 6 2014
5 posts
Popular Posts
karthickgururaj
Pick three points on a plane at random (assume uniform probability density across the plane). What is the probability that the triangle so formed is obtuse angled? Source: general internet, with s
DeGe
koren
Please pay attention - I prove clearly that any obtuse triangle corresponds to one of the acute-angled, which shows clearly that we have 50% chance to choose one or the type no matter in which way yo
Posted Images
52 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.