Happy 3 year anniversary! I'm honored the video was linked by Cleve Moler (creator of MATLAB). blogs.mathworks.com/cleve/2017/09/25/how-far-apart-are-two-random-points-in-a-square/
I did the same but with a circle of radius R instead of a square. That's a harder problem and I solved it. The answer is 128R/45π. No computer no excel no rows. Just a pure and accurate mathematical solution. For R=1 the answer is 0.905414787....... A computer solution (using a sample of 40,000 points) gives the same result. A very simple problem is to find the average length of a cord in a circle of radius R and the answer is 4R/π ( π= 3.141592654...)
I challenge you to argue that this is not correct: the average = sqrt(2)/2. The longest distance =sqrt(2), the shortest = 0, therefore answer= (sqrt(2) + 0)/2 :)
I was going to do it with excel and use 1million rows. He [Presh Talwalkar - the author] gets the answer using 10,000 rows. But I was stumped in his 2nd solution, even though I figured it would use integration. ...
Me too! Though I'd also just used the napkin to blow my nose, and its contents, including the solution to this problem, were broadly indistinguishable from one another.
It took me a minute or two using the Monte Carlo method he described first. Before I clicked, I was hoping there was some cleaver solution though, not just two obvious, conventional, brute-force methods.
I'll never [your weakness placeholder]. it took me [short period for micro despair] before I realised I could just close the video and not have to worry about it.
I was like, well it something in between 0 and sqrt2 (so average is ~0.7) and smaller numbers should be more often, so lets multiply it by about 66%, and from head it was ~0.5
I have a minor in math, and I found it quite tricky. You really have to ensure you follow each step. If you didn't understand a step, I would post your question to some of the online math forums. That way you can maybe figure out where you got lost. For example, while I understood the concept of converting from rectangular to polar coordinates, I did not quite follow how that allowed a single integral. So in this example, I would have to go back to that step I failed to connect to dots, and start trying to get from A to B. Another thing to know is that some integrals are very hard to derive - you will note he glosses over the integrals, by just saying they are well known. It's like that in math classes too - sometimes you just use known integrals and such and they don't prove them to you. That's about as complex of an integral as I would personally like to deal with, heh
+Gearbox: Focus on just regular, single variable integral calculus for now. Build your foundation in that before looking at multiple variables (and multiple integrals) with Jacobian transformations (changing your coordinate system(s) mid problem).
The quadrupe integral _is_ tractable but it took me five A4 pages. And I have miscalculated the coefficients somewhere. So yes, your solution is better than what I could figure out.
@@General12th without specifying A4 size we wouldn't have any idea of how much work it is. Of course, we still don't have the full idea because we don't know handwriting size and whether Filipp used both sides.. but we're a bit closer.
wow your teachers must have been pretty generous. I would have never received half credit just for that. my math teacher all through high school would have called it "bare minimum".
Thanks for the challenge, +Altum Novo. It turns out that the integrals get a lot more complicated. To allow the use of spherical coordinates, I place the cube centred at the origin. The first part of the problem is similar to the square case, and you get the integral over 8*sqrt(x²+y²+z²)(1-x)(1-y)(1-z) dx dy dz with limits -1/2
Now, to answer that problem for any dimension: mathworld.wolfram.com/HypercubeLinePicking.html It turns out 7 is the lowest dimension where the answer is larger than 1. It actually goes to infinity with increasing number of dimensions.
And Talwalkar is actually pronounced as Tull-vull-kurr, as in "hull" of the ship and the first "T" is pronounced as it is pronoucned in Spanish. Talwalkar's is a big health company in India with a chain of gyms and other fitness products. Named after its founder, Vishnu Talwalkar. "Kar" is suffix in the Marathi language which is preceeded by a place name, usually ancestral village and signifies a person from that place. Just like LondonER, New YorkER. Talwalkar is someone from "Talwal". People from Mumbai are referred to as Mumbaikars.
I'm grateful whenever someone features my work. Now I'm returning the favor by featuring some of the places MindYourDecisions is showing up. I'm honored to be mentioned by Cleve Moler (creator of MATLAB) in this post: How Far Apart Are Two Random Points in a Square? Check it out! Link: blogs.mathworks.com/cleve/2017/09/25/how-far-apart-are-two-random-points-in-a-square/
I beg to differ. Why is it so complicated, yet illogical? To calculate the average value of the distance between all the possible 2 random points, we first need to map out, a near infinite number of pairs of points. The closer the distance between any 2 points, the higher the chance of occurrence. This will logically produce a near infinite pairs of infinitely close points. Therefore, the principles of probability dictate that, the average distance between 2 random points in the square, should give an approximate value infinitely close to 0. The longest possible distance between any 2 points in the square, are the lengths between its diagonal ends. The points that produce the shortest possible distance (which is near 0), meanwhile, will fill up every space in the square. Final answer has to be close to 0. ☺️
Yi Jiun , I think that the reason why the result is not 0 is that, due to the uniform distribution of the points, the probability to get a very small distance for example < 0,002 = pi*0,002^2 is smaller than to get an more bigger distance 0.002< 0.5 = pi*0,5^2 - pi*0,002^2
ToFu right? Just say the longest distance possible was 1 and the smallest distance possible is really minute and is practically 0. So it's about .5 or just a little over since you know the distance could never be exactly 0.
1/3 and that one is only much simpler as a mechanical calculation. There, you have to think about which domain is the absolute value |x1 - y1| positive / negative and split the integral accordingly.
Can you explain this in a little more detail? I don't really understand your explanation. My numerical approach to solving this sees everything as absolute values and still spits out 1/3 as an answer.
BurninAss Well, you have two random variables X and Y ~ Uniform(0, 1) distributed as uniform between the range 0 and 1. What you wanna find out is the expected value (average) of the random variable say S = |X - Y|. To get this average distance, you integrate over |x-y| dx dy with limits of double integration being x going from 0 to 1 and y going from 0 to 1. To do this integral, you have to get rid of the absolute value bars. |x-y| is just (x-y) for all values of y x. So you split the double integral into these two parts (or just 2 times the first part since it's symmetric), and change the limits for y integral from y = 0 to 1, to y = 0 to x (since this is the region where y (x-y)). From there onward it's an easy double integral. It will make a lot more sense if you just write the steps down on a piece of paper.
xXxBladeStormxXx I actually worked it completely different: If we divide the segment to N equal segments, say 10, and the points can only be between segments - the expected value is 2*1 + 2*0.9*0.1 + 2*0.8*0.2 +2*0.7*0.3 ...(combinatorics) Now, if When N approaches to infinity this sum becomes the integral 2*x*(1-x) dx from 0 to 1 which is 1/3.
This exact problem was a question on a homework set in my probability theory course. Our textbook covered a similar problem that I referenced heavily while working on it and it still took a good part of an hour to finish. This video makes it seem so simple, well done.
I thought that there have been too many easy questions in the past weeks, but this was really top notch! Loved every moment of it. I'm gonna miss maths a little going to Med School, but hey, I'll find my own problems that need mathematical modeling. Thanks for quenching my thirst and keeping up the drive!
Wow.. Even when I don't come up with the answer myself, I can usually follow your explanations. this one was just beyond. I took Calculus in college 20 years ago, but I'm clearly rusty. I understood the estimate process, but the double integrals and how you got the numbers you did when you switched to absolute values of delta instead of calculating distances between all points... that was beyond me. I guess that happens when you take something that could be a class long lecture and instead of having time to teach it, you have to condense it down to a 10 minute follow me while I do the problem. It's still enjoyable to watch. And it make sense to me that the average would be lose to .5. I'm not sure i can explain why, but i just expected the average to be close to half the distance of the lengths of the legs. since the hypotenuse of a right triangle with sides 1 is only 1.4 does that help the average stay closer to half the legs. Would the average distance of a square with sides 3 be way larger than 1.5? and would it get further away from the middle as the sides got bigger because distances can go diagonally?
No, I think the answer for a square with side length n should just be n times Presh's answer. Suppose we gave this problem a concrete unit like yards. The average distance should be x yards where x is the value Presh found. Now if we instead considered each side as being 3 feet = 1 yard, we'd have the problem you asked about. The side length hasn't actually changed, so the answer should still be x yards and when we convert that to feet, we get 3x feet. Since this logic works for any two units of measurements (w/ any ratio), the average distance should always be nx for a square with side length n.
i 2nd that.. drop the easy ones, this video was awesome! it's been awhile since I've been totally stumped by MYD. normally i either get it, or fall for the trick.. i guess i did realize the numerical brute force approach, but that doesn't really count. geeze I forgot a lot of calc. Thanks again MYD for the fantastic puzzle!
I also thought in this way There are infinite points, so infinite distances between two points. The max is root of 2 ... agree The min is 0,0000000000000000....1 So that (root of 2 plus 0,000000000... 1) / 2 should be the answer. 1,41421356237 + 0,00000000001 = 1,41421356238 : 2 = 0,7071 ...
My first guess was about 0.561 so I'm pretty happy with that My solution, vaguely, was that the answer had to be bounded between 0 and sqrt(2), but more realistically, between 1/2 and sqrt(2)/2 Since those two extremes were when my line crossing the square was horizontal (theta=0) or diagonally (theta=45 degrees), I just averaged them according to theta (integral 0.5/cos(x) dx from 0 to pi/4)/(pi/4 - 0) = about 0.5611.... I only swept out 1/8th of the square because all the other 8ths would've been the same.
I got same answer by imagining. I imagined a square with 16 points in he shape of a square and drew a diagonal cutting the square into 2 triangles and I chose one of it, starting at one of its vertex there are 9 outcomes and 9/16 tuns out to be 0.5625. Idk why but it worked that way.
Well, mentally I got this : Minimal distance : 0 Maximal distance : Sqrt (2) (the diagonal) Average? Sqrt(2)/2 Which is within boundaries. Then I saw your video and felt stupid. Someone with me?
One method to estimate the answer is to divide the square into n = 2x2 = 4 blocks and then consider only the center points of the blocks. The average distance between the center points is about 0.57 - a pretty good estimate for not much work! The estimate can be refined by increasing the number of n blocks with (n-1)*n/2 unique distances to average.
Reduction from quad integral to double using p.d.f. is thrown without a single explanation as to why it works. One important thing I've learned in my school days (before and after graduation) is that reducing nested integrals is never trivial. This seems like someone did all the computation the hard way, then found out a simpler similar looking integral leading to the same result, and then gave the name p.d.f. to the factor that converts one to the other. So this video is just reversed reasoning using a fact as proof of it's own definition.
“With just horizontals and verticals, it’s going to be 0.5 , but there’s also diagonals so it’s going to be a bit more” is what I thought. No idea if that makes sense but it’s close enough to the answer to make me feel happy.
Method to avoid using distributions: Any two points from S=[0,1]x[0,1] define a distance vector V of modulus D with D^2 = |Dx|^2 + |Dy|^2. Let's also define an associated rectangular area A=[1-|Dx|, 1-|Dy|] for any of these vectors. All possible origin points of vectors parallel to V, Vi = Pi + V = (x+Dx, y+Dy) are contained in an area with the size of A. Take into account that flipping the origins and ends of these vectors yields a similar set with the area on the opposite corner. For any pair of positive deltas that define D in the formula above, there are four combinations of Dx and Dy due to signs and absolute values. We've taken already two of these combinations already and there are two more that can be obtained by reflecting horizontally or vertically our original vector V. This means that for any pair of positive deltas that yield these sets of vectors, there are 4 copies of the same area. With all this all possible vectors are now taken into account. To get the average distance, we want to add up the distance D of any of these vectors with positive deltas, so it will be D times A for each vector, hence integrate 4DAdA over S.
I wrote a PHP script that iterated through every line in an n x n grid and came out with 0.5214575816589 (for n=9999) - higher values of n would give me higher accuracy but not a great deal of point due to the time it takes to brute force this. Would never have been able to do that integral
Figured it out until the quadruple integral. Then got stuck. Also had the idea of using the Delta(x) and Delta(y) as variables, but I thought that would just give me much more work, finding the distribution etc., but it turns out to be easier.
5eurosenelsuelo I used a result from probability. We have that tge average of the value of an event is the sum of all the possibilities times their respective probabilities. For instance the average when you throw a die is: 1/6*1 + 1/6*2 + ... + 1/6*6 = 7/2 Now this is for a discrete space, i.e. we can count those events. The problem above is that the points can be everywhere in the square, and their coordinates a real, so they coule be any irrarional number. But the idea is basically the same. You take the sum of all possible values times their respective probability. In this case it will be an infinite sum of infinitely small terms (as the probability of getting one point among infinitely many is infinitesimally small). So we'll get an integral. Here the event is getting two points P and Q, and the value is the event. The probability of getting two particular P and Q is infinitesimally small. But we have discretisise the square. We can draw a grid that splits it into n columns and n rows. Each intersection of the grid is the possible points that we could get randomly. In that case we get the same problem, but with a finite number of points for a fixed n. So we can use our formula for the average in discrete spaces, i.e. the sum of all possible values times their probabilities. Then we let n tend to infinity and we get our result. If we fix the point P and the first coordinate of Q, then we just move the second coordinate of Q. Then we'll get a sum from k= 0 to n of terms dependent on n (and k). By rewriting it a bit, we can use Riemann integration to write the limit of a sum as an integral, namely: lim (n->0) 1/n*sum(k = 0 to n) of f(k/n) = integral (from 0 to 1) of f(x)dx. The 1/n will come from the probability of the second coordinate of Q being one of the n possible values, f will be the length of the segment [PQ]. So you get the first integral. By doing that now for each coordinate we get four of these. There are some other ways to explain it, the same principle though. The second method he uses after realising that 4 integrals is a lot is actually the same. Just now he takes the different lengths Delta(x) can have instead of the different values the coordinates can have. All he has to do is to adapt the probability, namely adding the probability that the segment has length Delta(x). And same for Delta(y).
All right I thought I got it but when I tried in a paper I realizided I can't yet. The example with the die is nice and I totally understand it. I'll try to write with math but it's very hard here (value of the event 1)*(prob of the event 1)+(value of the event 2)*(prob of the event 2)+etc In this case the event is the distance between PQ which numerical value can be calculated by pythagoras and can take any value from 0 to sqrt2 for this square. Then I have to multiply each event by its probability and here is when I get lost and mad. I see I'll need to integrate to do that multiplication because we're working with infinite values but I just don't see how to know what's the probabilitie of each event. I understand you already tried to explain to me so if you think you did all you could is totally perfect if you redirect me to some book or webpage. Thanks anyway:)
5eurosenelsuelo I'll try to write it mathematically. Imagine you have split the square into n rows and n columns, by painting a grid into the square. Now you don't accept all points on the square, but only the intersections of the grid. So you get (n+1)² points, or n² or (n-1)², depending on whether you take the the border of the square into consideration. To make it easier let's say we have n² points, that is if we take the points on the left and bottom border, but not the ones on the right and upper one. So the points have for x-coordinate one of the following: 0/n, 1/n, 2/n, 3/n, ... (n-1)/n; and for y-coordinate: 0/N, 1/n, 2/n, 3/n, ... (n-1)/n. For instance points on that set would be (1/n, 5/6), (0,2/6) for n = 6. Points that are *not* in that set would be for example: (0, 2/5), (3/6, pi), (0,1). Let's call that set A_n. So here you have finitely many points: n² to be precise. I name you any two points B and C. What is the probability, if you take two random points of that set A_n, to get B and C? That's 1/n² * 1/n² = 1/n⁴ (B and C can be equal). We have that A_n² ist the set of all pair of points in A_n, right? For any pair in A_n², we have consider it's length, i.e. the distance between the two points. So now to calculate the average length, we can take the sum of the lengths of all pairs in A_n² times the probability that they appear, which is 1/n⁴. So the average would be: sum over all pairs p of A_n² of [1/n⁴ * length(pair)] = 1/n⁴ * sum over all pairs p of A_n² of length(pair) Now we can split that into 4 encapsulated sums, the 1st sum makes varying the x-coordinate of the point A, the 2nd sum makes varying the y-coordinate of the point A, the 3rd sum makes varying the x-coordinate of the point B, and the 4th sum makes varying the y-coordinate of the point B. Eventually we can split the 1/n⁴ into four 1/n, each one will be put in front of a sum. So the inner sum will be: 1/n * sum 0 to n of [lenght(pair)] and the length of the pair can be described by the coordinates of the points. This will give us a Riemann integral if we let n tend to infinity. So we'll get the integral from 0 to 1 of the length(pair)dy_B . Then by doing the same with the other sums we will get the four integrals and dy_B*dx_B*dy_A*dx_A in the end. Another way, and maybe an easier one too, is to see this it the following way: Let be A the set of all points in the square (so [0,1]²), then A² is the set of all pairs of points in the square ( = [0,1]⁴). Let be p in A² a pair of points. Let d be the distance function, so d(p) gives the distance between the two points that form p. You see that we don't really talk about distance of two points (which are two objects), but length of a pair p (one only object) in A². The average length in the square is then given by: integral over A² of [d(p) (dμ)] (dμ defines the measure, not important for now, it's like the dx in a one-dimensional integral). That's a result from probability. Actually it derives directly from the definition of the average in probability (in continuous spaces). So you go over all A² and integrate the length. You can also take you variables x_1,x_2,y_1,y_2 to describe the points (x_1,y_1) and (x_2,y_2). So to go over all A² = [0,1]⁴, you can go for x_1 over [0,1], then for x_2 over [0,1], for y_1 over [0,1] and y_2 over [0,1], and your dμ will become dx_1*dx_2*dy_1*dy_2. So you'll get the integral that we looked for.
He glossed over all of the hard stuff not even trying to explain any of the hard stuff and went into super hard detail of all the stuff. This a great example of what not to do if you plan on teaching to somebody.
That wasn't really the point was it? For many people, myself included, even though I'm actually rather good at math, integrals and differentials is advanced stuff. Personally I've had the opportunity to learn at least, but there's simply too much to remember for my defective memory. It's not simply a matter of understanding the concepts, like with say trigonometry.
Felix Nielsen For some people this level of problem is as "simple" as trigonometry (whether due to trigonometry being foreign or a comfort with calculus). You comparing this problem to Stephen Hawking level analysis insults all those that are ambitiously attempting to solve his standard problems but sometimes falling short. It's like saying "everything you've done before is SO SIMPLE (and those that haven't gotten them are dumb)... but NO ONE can get this one because I can't. So stop teaching us and give us more problems that make me feel good about myself!" In the end, I just found your opening post a bit insulting.
You're not listening. You made something big out of something small, and I explained why it is in fact objectively very difficult. That's that. There's nothing else to is. Furthermore you proclaim that I'm insulting people, when nothing could be further from the truth. That in itself is an insult. You then go on to tell em what to do and not to do, and implying that I'm stupid. You can't put it however you like. It is you who are in the wrong and it is you who have made an insult. As for the problem, I have no issue with it on it's own, but asking "Did you figure it out?" as that is in anyway likely, is rather stupid I think, though that was not at all why I posted what I posted. It was simply a proclamation that I didn't have a chance in hell of figuring it out. I wouldn't even know what to Google for, and though you obviously will find it hard to believe, I am actually rather intelligent, I simply don't have the ability to remember a bunch of complicated formulas that have no use in everyday life.
Felix Nielsen As a comparison, I found it fairly simple... so how would you like it if this was his standard difficulty (my guess is you wouldn't watch his videos then) and you still tried them to further your mind, but then at some point someone (me for an example) wrote "this puzzle is ridiculous!" even after he explained it. You can take offence to my description or the fact that I called you out... honestly I don't care. I'm just trying to inform you that your comment could be taken offensively (although I was trying to do that discretely to begin with.. but you didn't seem to understand).
As an ECE student, i first thought how simple it is to just generate numbers and provide the average of distance. However, geometrically my initial thought was that we can draw a circle inscribed to the square so the majority of points are going to have an average distance of 0.5. I loved the integrations' solution and how helpful polar coordinates were.
Perfect video for the next time I teach a senior level probability course! I will make sure to read the top rated comments out during class for extra humor.
"I'm guessing it's about 0.5, but a bit off" "This probably has some analytical solution I would not think of in a hundred years" "Eh, just simulate the thing numerically"
@@asiamies9153 I think for about 100 million. After that the average was steady enough that i concluded the result should be very close to the real answer, which was enough for me.
I tried it in a very different way,... I just calculated the average distance from one x1 to another x2 point, which is 0,36- ignoring y completly. This is very easy to do, just calculate the average of each point to another. So for example if your x1 is 0, the average to a random x2 is 0,5 -> (0+0,1+0,2+0,3+0,4+0,5+0,6+0,7+0,8+0,9+1)/11 , go on with x1 is 1 and so on, in the end it's ((0,5 + 0,418 + 0,354 +0,309 +0,281)*2 +0,272)/11 = 0,36. Since this is a square, the average distance from one y1 to another y2 point is also 0,36. Now we have an triangle with the points A, B and C. The distance from A to B is 0,36 - the distance from A to C is also 0,36. We now have to figure out the distance from B to C - which is our end result. So sqrt(2*(0,36^2)) = 0,513 which is kinda close to the result from this video. I'm not very good in math, so I'm not quite sure why this isn't the exact same result. If someone can enlighten me, please do it! Also sorry for my bad english, I'm from germany.
I think you're getting only an approximate value because x1 and x2 are continuous variables, i.e., they can take any value from 0 to 1, not just 0.1, 0.2, 0.3 etc, but also something like 0.123011345 and so on. You treated them as discrete variables, hence you get an approximation, which is close, but would improve if you included more values in the interval 0 to 1.
He basically just "integrated". But using a poor approximation. More points would (probably) give a better result, and the integral is exactly THE result.
Yh, I had no chance :P I can do integration for basic functions using rudimentary methods(IBP,u-sub etc), but chancing coordinates for a quadruple integral? Nah.
I thought root(2)/2. What I did is I said: What's the maximum possible distance? Well that'd be 1 squared plus one squared and then the sqrt of that. So root(2) is the maximum distance. If the minimum possible distance is zero, just average them out. root(2) plus zero is root(2), then divide it by two.
I kind of figured it out... but, instead of paper and pencil, I wrote a Python program that generates 2 random points in the square, calculates the distance between them and then finds the average distance. It's amazing how it matches exactly the same value :)
You know? I really paused the video and went to try it myself. FOR FOUR YEARS. Ok, i just actually worked on it every now and then. I knew it would come down to a complicated integral, but i wasnt very interested in that. Actually, i was more interested in how many ways this could be approached, by geometric constructs, by intuition, by a "lazy statistical" approach, and of course, by programming a bunch of random points and averaging (though i wanted to leave this option to be the last as it would give me the number and interfere with my intuitive methods i was constructing) I got some interesting results out of these methods, which im much more proud than the more precise number i got from the simulation and from the exact calculus.
If the box size changes what happens to the average length? Fox example what is the average length between two random point in a 5X5 box and a 5x8 rectangle? Is the average length a linear solution as the box size increases?
Yeah it relied on a lot of background knowledge. A university mathematics course helps, though you can always teach yourself. 3brown1blue channel has a load of great videos.
My though procces (before seeing the vide, probably wrong lol) -The maximum distance posible is the square root of 2, and the minimal is (in a proctical sense) 0 -There can be done an infinit amount of lines of sizes [square root of 2 to 0[ -Intuatively as smaller lines require less space to be put, there should be more small lines. But as the amount of any line is infinit, I’ll consider the amount of small lines to be equal to big ones. This logic aplies to everything in between, as the distribution should ve equal theought the possibilities. -To simplifie the problem I’ll do the average distance in a circle of a diameter of 1: - In this case as the max is 1 and the least is basically 0 the averige distance should be: (1+0)/2= 0.5. Also as the distribution of values should be equal above and bellow the average we can ignore those values. -To answer the circle problem we can subtract the area of the circle to the area of the squre Area of square = 1 Area of circle = 0.785398... 1-0.785398...= 0.214621... I’ll treat this new area as a circle to get it’s average length First I’ll calculate the diameter of it using a bit of algebra and the area formula (I’ll skip that part cause it’s kind of long, the diameter is: 0.26136160043... Now, using the knowledge of how to get the average distance of a circle we can know that the average distance of this one is: 0.13068080021 So now we need to add this to the average length of a line in a circle (0.5) 0.5+0.13068080021= 0.6306808002 So my final answer is that the average length of a square of side length 1 is 0.63068080021... Also, sorry for my grammar I’m not native English lol Edit: I was wrong lol
I got till integration. But that jump of logic to convert x1,y1,x2,y2 to del x del y and then to polar coordinates was pure genius. But to be honest, I am rather pleased with myself for reaching as far as I did.
I love it..."Did you figure it out?".... I didn't have a clue ( ok ...I did follow the random number crunching method ) and have decided to just die in ignorance rather than try to grasp what the heck you did with those integrals.
I have no idea why you made things so complicated and did not map this onto the 1D variant. Let E(delta(x)) denote the expected difference between two points chosen at random in the interval [0,1]. If you know this value, and use the fact that E(delta(x)) = E(delta(y)) for the 2D variant, then the answer is simply sqrt((2*E(delta(x)))^2).
***** The chance of randomly choosing two points in the [0,1] interval which lie distance 0 apart (i.e. exactly the same point, with infinite precision) is zero. Hence the expected difference -- which I called E(delta(x)) -- is definately > 0.
Yes I figured if you knew the average value of deltax and deltay then you can just put those into distance formula and get an average distance but I guess not. Still can't wrap my head around why it doesn't work and why it's a bit smaller than the actual answer
Then again if the same idea is applied to average distance between two points on a line then the formula for that is just |x1-x2| and the average value of x1 or x2 would be .5 which would make the average distance 0 which is wrong. It's harder to see where it fails in the square but seeing it fail on the line it's not surprising that it gives the wrong answer
Except it is not 0.5. The expected distance of a single point to 0 (or 1) is a half, but the expected distance of 2 random points *to each other* is a completely different number.
I had a similar problem given to me as an interview question for a job. You have a sheet of ruled paper and are given a pin that exactly fits between the ruled lines vertically. If the pin is randomly dropped from some height above the paper, what is the probability that the pin will straddle one of the ruled lines?
I tried the spreadsheet method, for a circle of radius 1 or diameter 2, and i got about 0.72, so for a circle of diameter 1, from my calculations, it should be 0.36. Not really sure 100%.
Hm, I tried something with MatLab and got 0.453. I created to sets of Points with coordinates between -0.5 and +0.5 and then removed all points with a distance to the origin greater than 0.5. After that I calculated the distance between two points, one from each set, and took the mean. But maybe I'm wrong.
Wow. This sure was a good one. I have to admit, this was way beyond me. Do you think it would be a good idea to have like a difficulty rating at the start so that people with less classroom experience could pick out the ones which have emm... fewer quadruple integrals? I absolutely loved the video and that such a simple problem can have such a complex solution, but when the easier problems come along, I'm never sure if I want to even start in case it's like impossible.
Brute force solution for n-dimensions in Javascript: function averageDis(dimension) { const iter = 10000000; let a = []; for (let i = 0; i < iter; i++) { let sum = 0 for (let d = 0; d < dimension; d++) { let d0 = Math.random(), d1 = Math.random(); sum += (d1 - d0) * (d1 - d0); } a.push(Math.sqrt(sum)); } return a.reduce((t, n) => t + n, 0) / iter; }
I calculated it to be 0.527 from a different method. I was surprised I was off even though it was just by a bit. What I did was divide the triangle into 2 parts, 1 being 1 third and the other being 2 thirds. The average distance should be the max possible distance from the weight center of the square divided by two (aka all possible above half minus all possible under half). So it's sqrt (1^2 +(1/3)^2)/2 = 0.527
The figure at 5:12 might be misleading. There has been a change of coordinates so that this square is not the x and y of the original square but deltax and delta y. Also tge triangular distribution can be considered by looking at the difference in scores between two dice. The maximum distance can be acheived in two ways (6,1)(1,6). The minimum distance in 6 ways(pairs). So the pdf of the distance decreases with distance. Thus for an x separation of 1 we require the chosen points x1,x2 at the extreme left and right of the square. with a pdf of zero. This is where the factor (1-x) comes from.
+djahid abdelmoumen because I tested it? You can also do it mathematically and you'll get the same result, but it's just way faster to write a short program to calculate it. For the why it's not 0.5: The chance of the points being closer together is higher than them being farther apart, so the result is
Side length = 1 Max length inside the square = diagonal (√2 or approx. 1.14) Min length = 0 We then find the average of these two values. Therefore, the answer is approx. 0.57. And that's the perfect answer. Hetansh
Altum Novo the consensus online seems to be that as the dimension "n" goes to infinity the solution approaches sqrt(n/6), which would mean that the points would be "infinitely far apart," although this has no meaningful analog. This result is possible because an infinite dimensional hypercube is not "bounded space" in any conventional sense.
Yes unfortunately the average length for a hypercube of infinite dimensions is infinite because as long as 1 of the lines you can make inside the cube is infinite in length, then the average of all the lines has to also be infinite. The longest line you can make in the object is sqrt(n) = sqrt(infinity) = infinity. The hypercube of infinite dimensions all having length 1 is a very strange object, almost like an infintely spiky ball, a line from one side to the other equals 1, but going from corner to corner it equals infinity.
Altum Novo You know... Infinity isn't a number, right? So you can't use it like that in an equation. It doesn't matter how many dimensions you have, it will still be a region defined as [0,1]^n, which clearly is bounded, so there is no way that the distance between 2 points is infinite. Btw: The maximum distance between 2 points will be d=sqrt(n), which means that the average can't be infinity. It has to be less than d.
Square where sides each = 1. The greatest distance between points is the hypotenuse of a right triangle, corner to opposite corner. This right triangle has 3 known angles, & 2 known side lengths. 90/45/45. And 1 and 1. A(2) + B(2) = C(2). So 1(2) + 1(2) = 1 + 1. = 2. C(2) = 2. Hypotenuse = square root of 2. = 1.41421 . 1.4 for simplified illustration purposes. The least distance being just > 0. Divide 1.4 by 2 = "average" = 0.7 .
integrate (x-a)**2 + (y-b)**2 dx dy da db from 0 < x < 1 and 0 < y < 1 and 0 < a < 1 and 0 < b < 1 this is how I did the problem which gave 1/3 which is actually really close, can you spot the reason why it is incorrect. I know it computes the lengths twice but it doesn't matter since the integral is symmetric, to get the average, you divide by the area which is simply one so that doesn't change the answer.
The distance between random points on a CIRCLE with area 1 is about 0.592. You have to use cylindrical coordinates and use the cosine rule. Matlab code: r1 = rand(100000,1)*1/sqrt(pi); r2 = rand(100000,1)*1/sqrt(pi); th1 = rand(100000,1)*2*pi; th2 = rand(100000,1)*2*pi; for i = 1:length(r1) d(i) = sqrt(r1(i)^2 + r2(i) - 2*r1(i)*r2(i)*cos(th2(i)-th1(i))); end avg = mean(d)
An easy and quick way can be done by considering 2 sqr triang. of side 1 & 1/n, and 1/n & 1/n, they will look after the slanted and parallel lines respectively. We will not use integrals but only sums (only approx. value will be enough). after simplifying we have: 1/4(Sum from n=1 to n=inf. of 1/n), we then calculate for only the first four values: 1/4(1+1/2+1/3+1/4)=1/4(2.0833)=0.5208 if we express that with only three decimal places, we have 0.521
Just use analitical geometry and make it so x+y=1. And (x1 - x2)squared + (y1 - y2)squared = (the result)squared. It's literally pitagorium, sorry for the awesome english, I am black.
What you're doing at 1:00 is something arbitrary we learned in high school that I never really figured we'd use. But if you're playing Minecraft and trying to find the distance between 2 spawners for a mob farm, you have to do this exact same thing but with a 3rd dimension. Fortunately you can solve one plane at a time, but it's still a fair amount of work
Happy 3 year anniversary! I'm honored the video was linked by Cleve Moler (creator of MATLAB). blogs.mathworks.com/cleve/2017/09/25/how-far-apart-are-two-random-points-in-a-square/
I did the same but with a circle of radius R instead of a square. That's a harder problem and I solved it. The answer is 128R/45π. No computer no excel no rows. Just a pure and accurate mathematical solution. For R=1 the answer is 0.905414787.......
A computer solution (using a sample of 40,000 points) gives the same result.
A very simple problem is to find the average length of a cord in a circle of radius R and the answer is 4R/π ( π= 3.141592654...)
I remember solving this in grade 12, for JEE prep
I challenge you to argue that this is not correct: the average = sqrt(2)/2. The longest distance =sqrt(2), the shortest = 0, therefore answer= (sqrt(2) + 0)/2 :)
Actually the term random should be mentioned explicitly as uniform distribution in this case. In general the answer to 'random' cannot be given.
According to _RANDOM POINTS ASSOCIATED WITH RECTANGLES_
(A.M. MATHAI, P. MOSCHOPOULOS, G. PEDERZOLI)
published in _RENDICONTI DEL CIRCOLO MATEMATICO DI PALERMO_ , SERIE II - TOMO XLVIII (1999), pages 163-190
The average distance between random points in a rectangle is
1/15•( Lw³/Lh² + Lh³/Lw² +
+ d•(3 - Lw²/Lh² - Lh²/Lw²) +
+ 5/2•
•( Lh²/Lw log [(Lw+d)/Lh] +
+ Lw²/Lh log [(Lh+d)/Lw] ) )
where:
Lh - height length;
Lw - width length;
Diagonal d = √(Lw² + Lh²)
In this specific puzzle
Lh = Lw = 1
d = √2
1/15•( 1 + 1 +
+ √2•(3 - 1 - 1) +
+ 5/2•
•( 1 • log (1+√2) +
+ 1 • log (1+√2) ) ) =
= 1/15•( 2 + √2 +
+ 5/2•(2•log(1+√2)) ) =
= 1/15•( 2+√2 + 5•log(1+√2) ) =
= 0.52140543316472...
"Did you figure this out?"
:l
"Who do you think watches these videos? Paul Dirac? Karl F. Gauss?
I was going to do it with excel and use 1million rows. He [Presh Talwalkar - the author] gets the answer using 10,000 rows. But I was stumped in his 2nd solution, even though I figured it would use integration. ...
I figured out!
Yes, Im my way to get my nobel prize, I solve this in a napkin.
Me too! Though I'd also just used the napkin to blow my nose, and its contents, including the solution to this problem, were broadly indistinguishable from one another.
I'll never solve this. it took me 3 and a half minutes before I realised I could just close the video and not have to worry about it.
Your comment coupled with your profile pic is perfect!
+Real.Piece.Of.Work The laugh of loud.
It took me a minute or two using the Monte Carlo method he described first. Before I clicked, I was hoping there was some cleaver solution though, not just two obvious, conventional, brute-force methods.
I'll never [your weakness placeholder]. it took me [short period for micro despair] before I realised I could just close the video and not have to worry about it.
I guessed it was 0.5 and it was close to that.
"Did you figure this out?"
-
-
I find this question to be mildly humiliating.
"mildly"
I found the answer in 3 minutes
I mean... there are several approaches to the exact right answer on this problem.
@@MaxGuides Hi I know i'm a year late, but could you briefly explain a few of the alternative approaches for this problem? I'd really appreciate it.
I immediately thought “about 0.5“. Turns out I was off only by
High five bro
I was like, well it something in between 0 and sqrt2 (so average is ~0.7) and smaller numbers should be more often, so lets multiply it by about 66%, and from head it was ~0.5
And now the warranty period on your product is cut in half. I’m an actuary, so I profit and the customer is screwed by your laziness
Lol same bruh
I thought that since it has area of 1 so taking a line that divides it in two is 0.5
Pretty sure a circle with a radius of 0.5 would be 0.5. A square needs to be slightly larger due to the corners.
"This doesn't look too hard. I'll just have to ... wait ... ok, now this is a bit more complicated than I .... uh. Holy ..."
Every damn video... :P
I have a minor in math, and I found it quite tricky. You really have to ensure you follow each step. If you didn't understand a step, I would post your question to some of the online math forums. That way you can maybe figure out where you got lost. For example, while I understood the concept of converting from rectangular to polar coordinates, I did not quite follow how that allowed a single integral. So in this example, I would have to go back to that step I failed to connect to dots, and start trying to get from A to B. Another thing to know is that some integrals are very hard to derive - you will note he glosses over the integrals, by just saying they are well known. It's like that in math classes too - sometimes you just use known integrals and such and they don't prove them to you. That's about as complex of an integral as I would personally like to deal with, heh
+Gearbox: Focus on just regular, single variable integral calculus for now. Build your foundation in that before looking at multiple variables (and multiple integrals) with Jacobian transformations (changing your coordinate system(s) mid problem).
you just have to type that on wolfram alpha.
Dejaime Neto well, C's do get degrees, so if that's what you want to do then I won't stop you from not learning.
The quadrupe integral _is_ tractable but it took me five A4 pages. And I have miscalculated the coefficients somewhere. So yes, your solution is better than what I could figure out.
Why did you specify A4 paper? Do you often use other sizes?
@@General12th As a rule, I just snatch a couple of sheets from my home printer. And they happen to be A4 :)
@@General12th without specifying A4 size we wouldn't have any idea of how much work it is. Of course, we still don't have the full idea because we don't know handwriting size and whether Filipp used both sides.. but we're a bit closer.
@The Absolute Madman But what size is a "piece of mind", I wonder? ;)
@@ФилиппЛыков-д8е A "Piece of Mind" is about 6 minutes 22 seconds.
0 < average distance < 1.414...
hahaha lol
wow your teachers must have been pretty generous. I would have never received half credit just for that. my math teacher all through high school would have called it "bare minimum".
that's if you only consider the points that lie on the diagonal
Lawrence Mok Hmmmm nope. Any two points inside a square will be at a distance between 0 and length of side multiplied by sqr(2)
Actually we can say 0
No one:
Automatic translator: *"Hey this is pressure locker"*
LULW
Yeah!
lol
Haha
Lmao
I lost you at ''Consider a square...''
Nanika ahahaahah
😂
I lost him when reading the title: "What is the distance between 2 random points"
I lost it when i saw "mindyourdecision" name pop up
Why would I consider a square when the square never considers me?
Now do a cube.
It proably gets an extra intergal dz. The experission under sqrt becomes(x^2+y^2+z^2) and another factor of 2(1-z) inside this triple integral.
Thanks for the challenge, +Altum Novo.
It turns out that the integrals get a lot more complicated.
To allow the use of spherical coordinates, I place the cube centred at the origin. The first part of the problem is similar to the square case, and you get the integral over 8*sqrt(x²+y²+z²)(1-x)(1-y)(1-z) dx dy dz with limits -1/2
Oh, I was bet by half an hour... Well, still fun ;-)
Now, to answer that problem for any dimension:
mathworld.wolfram.com/HypercubeLinePicking.html
It turns out 7 is the lowest dimension where the answer is larger than 1. It actually goes to infinity with increasing number of dimensions.
The paper on box integrals in the references is a good read.
You know the maths are hard when Preshtal Walker stutters while explaining xD
Lol
It's Presh talwalker. Talwalker is an Indian surname.
you butchered his namd flip santa
Preshtal Walker ??? Do you know his brother Lukesky?
And Talwalkar is actually pronounced as Tull-vull-kurr, as in "hull" of the ship and the first "T" is pronounced as it is pronoucned in Spanish. Talwalkar's is a big health company in India with a chain of gyms and other fitness products. Named after its founder, Vishnu Talwalkar. "Kar" is suffix in the Marathi language which is preceeded by a place name, usually ancestral village and signifies a person from that place. Just like LondonER, New YorkER. Talwalkar is someone from "Talwal". People from Mumbai are referred to as Mumbaikars.
Just guessing before the video, is it
(2+√2+5ln(√2+1))/15 ?
Hakan Çakıcı You're the Lottery Terminator.
Hakan Çakıcı pretty good intuition you've got there ,huh?
Jesus christ it’s Jason bourne.
Hakan Çakıcı u cheated
YipHyGaming - Minecraft Agario Cytus and more! goteem
I'm grateful whenever someone features my work. Now I'm returning the favor by featuring some of the places MindYourDecisions is showing up. I'm honored to be mentioned by Cleve Moler (creator of MATLAB) in this post: How Far Apart Are Two Random Points in a Square? Check it out! Link: blogs.mathworks.com/cleve/2017/09/25/how-far-apart-are-two-random-points-in-a-square/
MindYourDecisions it was a bounce..... I did not understand it 😅😅
Hi,presh ..I have a great question...How can I mail you?
He estimated >0.52 to start ... I thought it would be just over 0.6 based upon an average of the maximum diagonals and the maximum straights.
I beg to differ.
Why is it so complicated, yet illogical?
To calculate the average value of the distance between all the possible 2 random points, we first need to map out, a near infinite number of pairs of points.
The closer the distance between any 2 points, the higher the chance of occurrence.
This will logically produce a near infinite pairs of infinitely close points.
Therefore, the principles of probability dictate that, the average distance between 2 random points in the square, should give an approximate value infinitely close to 0.
The longest possible distance between any 2 points in the square, are the lengths between its diagonal ends.
The points that produce the shortest possible distance (which is near 0), meanwhile, will fill up every space in the square.
Final answer has to be close to 0. ☺️
Yi Jiun , I think that the reason why the result is not 0 is that, due to the uniform distribution of the points, the probability to get a very small distance for example < 0,002 = pi*0,002^2 is smaller than to get an more bigger distance 0.002< 0.5 = pi*0,5^2 - pi*0,002^2
4:21 Simplifies into a double integral. This is going to be a long haul.
This is the point I started reading the comments.
my guess was 0.5 without watching
Me two but, those corner got me..
My guess was ~0.7 (square root of 0.5)
My guess is 1/3 of sqrt(2)
EDIT: Yep, wasn't even close lol
same
ToFu right? Just say the longest distance possible was 1 and the smallest distance possible is really minute and is practically 0. So it's about .5 or just a little over since you know the distance could never be exactly 0.
What is the average distance between two random points in a unit circle?
0.905
Robobrine How did you calculated that? 128/(45pi)
I wrote a small program to brute force calculate it.
I calculated the integral (probably wrong), and it yielded pi / 4
Unfortunately, you're wrong. The answer is 128 / (45 * Pi) ~ 0.9054147...
I mean I dont get what happened but it looked cool and seems real
That was interesting.
Here is a much simpler version:
what is the average length between two points on a line segment length 1?
1/3 and that one is only much simpler as a mechanical calculation.
There, you have to think about which domain is the absolute value |x1 - y1| positive / negative and split the integral accordingly.
Can you explain this in a little more detail? I don't really understand your explanation.
My numerical approach to solving this sees everything as absolute values and still spits out 1/3 as an answer.
BurninAss Well, you have two random variables X and Y ~ Uniform(0, 1) distributed as uniform between the range 0 and 1.
What you wanna find out is the expected value (average) of the random variable say S = |X - Y|.
To get this average distance, you integrate over |x-y| dx dy with limits of double integration being x going from 0 to 1 and y going from 0 to 1.
To do this integral, you have to get rid of the absolute value bars.
|x-y| is just (x-y) for all values of y x.
So you split the double integral into these two parts (or just 2 times the first part since it's symmetric), and change the limits for y integral from y = 0 to 1, to y = 0 to x (since this is the region where y (x-y)).
From there onward it's an easy double integral. It will make a lot more sense if you just write the steps down on a piece of paper.
wow that was fast! Having to get rid of |x-y| for an integral was the part that I was missing. Thanks.
xXxBladeStormxXx I actually worked it completely different:
If we divide the segment to N equal segments, say 10, and the points can only be between segments - the expected value is 2*1 + 2*0.9*0.1 + 2*0.8*0.2 +2*0.7*0.3 ...(combinatorics)
Now, if When N approaches to infinity this sum becomes the integral 2*x*(1-x) dx from 0 to 1 which is 1/3.
"Did you figure it out?" What am I? Einstein?
LMAO when the question was posed I said to myself: “About 0.5?” Then after complex mathematical disambiguation it turned out to be just ABOUT that
We r both haha
Haha same
Lmao
Same here.
Same here. Sometimes intuition is really powerful.
"Did you figure it out"? Yeah, I did it in my head.
I came here just to watch some smart numbers popping on the screen lol.
Smartest thing I've read so far lol
While enjoying a glass of slivovitz.
S m a r t n u m b e r s
So friken accurate 😂
This exact problem was a question on a homework set in my probability theory course. Our textbook covered a similar problem that I referenced heavily while working on it and it still took a good part of an hour to finish. This video makes it seem so simple, well done.
"Did you figure it out?" Really... you actually asked that question?
I thought that there have been too many easy questions in the past weeks, but this was really top notch!
Loved every moment of it.
I'm gonna miss maths a little going to Med School, but hey, I'll find my own problems that need mathematical modeling. Thanks for quenching my thirst and keeping up the drive!
Never mind, I apparently forgot about the harder ones. Whoops.
Please defend your lust for math recklessly. I don't know how often I had to explain the rule of three to a "doctor", when I used to work as an EMT.
That was a bit sadistic.... Good thing I'm a bit masochistic. ;)
Medicine has maths.
lagalil Many physicians haven't.
Wow.. Even when I don't come up with the answer myself, I can usually follow your explanations. this one was just beyond. I took Calculus in college 20 years ago, but I'm clearly rusty. I understood the estimate process, but the double integrals and how you got the numbers you did when you switched to absolute values of delta instead of calculating distances between all points... that was beyond me. I guess that happens when you take something that could be a class long lecture and instead of having time to teach it, you have to condense it down to a 10 minute follow me while I do the problem. It's still enjoyable to watch. And it make sense to me that the average would be lose to .5. I'm not sure i can explain why, but i just expected the average to be close to half the distance of the lengths of the legs. since the hypotenuse of a right triangle with sides 1 is only 1.4 does that help the average stay closer to half the legs. Would the average distance of a square with sides 3 be way larger than 1.5? and would it get further away from the middle as the sides got bigger because distances can go diagonally?
No, I think the answer for a square with side length n should just be n times Presh's answer. Suppose we gave this problem a concrete unit like yards. The average distance should be x yards where x is the value Presh found. Now if we instead considered each side as being 3 feet = 1 yard, we'd have the problem you asked about. The side length hasn't actually changed, so the answer should still be x yards and when we convert that to feet, we get 3x feet. Since this logic works for any two units of measurements (w/ any ratio), the average distance should always be nx for a square with side length n.
I think the hard part here is not even the integral , it is how you break down the problem of doing expected values
Please do more videos like this, not the primary school level mathematics in many recent videos.
Then he'd just be doing videos for math-heads, and that's a terrible viewerbase ;)
I agree with you! I've considered to unsubscribe before watching this new video.
i 2nd that.. drop the easy ones, this video was awesome! it's been awhile since I've been totally stumped by MYD. normally i either get it, or fall for the trick.. i guess i did realize the numerical brute force approach, but that doesn't really count. geeze I forgot a lot of calc. Thanks again MYD for the fantastic puzzle!
Maybe he should have two separated channel. I understand like 30% of the mathematics. Wasnt really that fun.
lol...I was just thinking the exact opposite of what you posted. This was way over my head. I am however glad there are bright math folks like you.
This is my math skills:
Shortest length 0
Longest length Sqrt 2
so sqrt 2 / 2 ? (≈0.707106781)
But there's only 2 ways of making a length of sqrt 2 and many more for other combinations
but is the distribution of lengths bell shaped?
That's what I thought
in the lottery you eitheir gain 1 million dollars or 0 dollars, so, in average, you gain 500k dollars. Congrats!
this would only work for a sphere.
Max: Root of 2
Min: ~ 0
Avg: ~ r2/2
that what i did lol
Unfortunatly for...all of us, maths do not work like that. Damn.
I also thought in this way
There are infinite points, so infinite distances between two points.
The max is root of 2 ... agree
The min is 0,0000000000000000....1
So that (root of 2 plus 0,000000000... 1) / 2 should be the answer.
1,41421356237 + 0,00000000001 = 1,41421356238 : 2 = 0,7071 ...
0.707, too bad estimate
I also jumped to root(2)/2 but I believe the min could be zero if the two points you generate have the same coordinates
First i thought that its a tough question......
Soon i realized that i can't even understand the solution part
So infinite many possibilities, I'm going to use calculus. (a few minutes later) Ugh, this is hard.
My first guess was about 0.561 so I'm pretty happy with that
My solution, vaguely, was that the answer had to be bounded between 0 and sqrt(2), but more realistically, between 1/2 and sqrt(2)/2
Since those two extremes were when my line crossing the square was horizontal (theta=0) or diagonally (theta=45 degrees), I just averaged them according to theta
(integral 0.5/cos(x) dx from 0 to pi/4)/(pi/4 - 0) = about 0.5611....
I only swept out 1/8th of the square because all the other 8ths would've been the same.
I got same answer by imagining. I imagined a square with 16 points in he shape of a square and drew a diagonal cutting the square into 2 triangles and I chose one of it, starting at one of its vertex there are 9 outcomes and 9/16 tuns out to be 0.5625. Idk why but it worked that way.
As the points keep increasing in the shape of a square that is 16, 25, 36 the answer by this method is approaching 0.52
This is what happens when people in the comments complain... GREAT JOB, PRESH! I LOVE THIS!
Well, mentally I got this :
Minimal distance : 0
Maximal distance : Sqrt (2) (the diagonal)
Average?
Sqrt(2)/2
Which is within boundaries.
Then I saw your video and felt stupid. Someone with me?
I think this would be correct for a line of the length sqrt(2).
I started with that as well, but then immediately saw that the number of "possibilities" increases the shorter the distances are.
Indeed. I think this is were I missed the point of the question and the "very hard" pqrt
Started with sqrt(2)/2 as well. Didn't imagine the problem to be this complicated
PositiveANegative i thought the same as you. i got 0.7
One method to estimate the answer is to divide the square into n = 2x2 = 4 blocks and then consider only the center points of the blocks. The average distance between the center points is about 0.57 - a pretty good estimate for not much work! The estimate can be refined by increasing the number of n blocks with (n-1)*n/2 unique distances to average.
Reduction from quad integral to double using p.d.f. is thrown without a single explanation as to why it works.
One important thing I've learned in my school days (before and after graduation) is that reducing nested integrals is never trivial.
This seems like someone did all the computation the hard way, then found out a simpler similar looking integral leading to the same result, and then gave the name p.d.f. to the factor that converts one to the other. So this video is just reversed reasoning using a fact as proof of it's own definition.
“With just horizontals and verticals, it’s going to be 0.5 , but there’s also diagonals so it’s going to be a bit more” is what I thought. No idea if that makes sense but it’s close enough to the answer to make me feel happy.
The average distance between 2 random points on a line with length 1 would be 1/3, not 1/2 in fact. But good try ;)
Method to avoid using distributions:
Any two points from S=[0,1]x[0,1] define a distance vector V of modulus D with D^2 = |Dx|^2 + |Dy|^2.
Let's also define an associated rectangular area A=[1-|Dx|, 1-|Dy|] for any of these vectors.
All possible origin points of vectors parallel to V, Vi = Pi + V = (x+Dx, y+Dy) are contained in an area with the size of A. Take into account that flipping the origins and ends of these vectors yields a similar set with the area on the opposite corner.
For any pair of positive deltas that define D in the formula above, there are four combinations of Dx and Dy due to signs and absolute values. We've taken already two of these combinations already and there are two more that can be obtained by reflecting horizontally or vertically our original vector V.
This means that for any pair of positive deltas that yield these sets of vectors, there are 4 copies of the same area.
With all this all possible vectors are now taken into account.
To get the average distance, we want to add up the distance D of any of these vectors with positive deltas, so it will be D times A for each vector, hence integrate 4DAdA over S.
very neat! thanks for the alternate explanation, i didn't get the probability density function part in the video.
Since I have no idea on how to approach this problem, so I wrote a python script that calculates the avarage of random arrangements. I've got 0.52.
I wrote a PHP script that iterated through every line in an n x n grid and came out with 0.5214575816589 (for n=9999) - higher values of n would give me higher accuracy but not a great deal of point due to the time it takes to brute force this. Would never have been able to do that integral
Figured it out until the quadruple integral. Then got stuck. Also had the idea of using the Delta(x) and Delta(y) as variables, but I thought that would just give me much more work, finding the distribution etc., but it turns out to be easier.
Could explain me why using that integral? Or tell me a webpage with related information. I'm looking forward to understand it
5eurosenelsuelo I used a result from probability. We have that tge average of the value of an event is the sum of all the possibilities times their respective probabilities.
For instance the average when you throw a die is:
1/6*1 + 1/6*2 + ... + 1/6*6 = 7/2
Now this is for a discrete space, i.e. we can count those events. The problem above is that the points can be everywhere in the square, and their coordinates a real, so they coule be any irrarional number.
But the idea is basically the same. You take the sum of all possible values times their respective probability. In this case it will be an infinite sum of infinitely small terms (as the probability of getting one point among infinitely many is infinitesimally small). So we'll get an integral.
Here the event is getting two points P and Q, and the value is the event. The probability of getting two particular P and Q is infinitesimally small.
But we have discretisise the square. We can draw a grid that splits it into n columns and n rows. Each intersection of the grid is the possible points that we could get randomly. In that case we get the same problem, but with a finite number of points for a fixed n. So we can use our formula for the average in discrete spaces, i.e. the sum of all possible values times their probabilities.
Then we let n tend to infinity and we get our result. If we fix the point P and the first coordinate of Q, then we just move the second coordinate of Q. Then we'll get a sum from k= 0 to n of terms dependent on n (and k). By rewriting it a bit, we can use Riemann integration to write the limit of a sum as an integral, namely:
lim (n->0) 1/n*sum(k = 0 to n) of f(k/n) = integral (from 0 to 1) of f(x)dx.
The 1/n will come from the probability of the second coordinate of Q being one of the n possible values, f will be the length of the segment [PQ]. So you get the first integral.
By doing that now for each coordinate we get four of these.
There are some other ways to explain it, the same principle though. The second method he uses after realising that 4 integrals is a lot is actually the same. Just now he takes the different lengths Delta(x) can have instead of the different values the coordinates can have. All he has to do is to adapt the probability, namely adding the probability that the segment has length Delta(x). And same for Delta(y).
That's a nice explanation
You helped me so much. Thank you:)
All right I thought I got it but when I tried in a paper I realizided I can't yet.
The example with the die is nice and I totally understand it. I'll try to write with math but it's very hard here
(value of the event 1)*(prob of the event 1)+(value of the event 2)*(prob of the event 2)+etc
In this case the event is the distance between PQ which numerical value can be calculated by pythagoras and can take any value from 0 to sqrt2 for this square. Then I have to multiply each event by its probability and here is when I get lost and mad. I see I'll need to integrate to do that multiplication because we're working with infinite values but I just don't see how to know what's the probabilitie of each event.
I understand you already tried to explain to me so if you think you did all you could is totally perfect if you redirect me to some book or webpage. Thanks anyway:)
5eurosenelsuelo I'll try to write it mathematically.
Imagine you have split the square into n rows and n columns, by painting a grid into the square. Now you don't accept all points on the square, but only the intersections of the grid. So you get (n+1)² points, or n² or (n-1)², depending on whether you take the the border of the square into consideration. To make it easier let's say we have n² points, that is if we take the points on the left and bottom border, but not the ones on the right and upper one.
So the points have for x-coordinate one of the following: 0/n, 1/n, 2/n, 3/n, ... (n-1)/n; and for y-coordinate: 0/N, 1/n, 2/n, 3/n, ... (n-1)/n. For instance points on that set would be (1/n, 5/6), (0,2/6) for n = 6. Points that are *not* in that set would be for example: (0, 2/5), (3/6, pi), (0,1). Let's call that set A_n.
So here you have finitely many points: n² to be precise. I name you any two points B and C. What is the probability, if you take two random points of that set A_n, to get B and C? That's 1/n² * 1/n² = 1/n⁴ (B and C can be equal).
We have that A_n² ist the set of all pair of points in A_n, right? For any pair in A_n², we have consider it's length, i.e. the distance between the two points. So now to calculate the average length, we can take the sum of the lengths of all pairs in A_n² times the probability that they appear, which is 1/n⁴.
So the average would be:
sum over all pairs p of A_n² of [1/n⁴ * length(pair)]
= 1/n⁴ * sum over all pairs p of A_n² of length(pair)
Now we can split that into 4 encapsulated sums, the 1st sum makes varying the x-coordinate of the point A, the 2nd sum makes varying the y-coordinate of the point A, the 3rd sum makes varying the x-coordinate of the point B, and the 4th sum makes varying the y-coordinate of the point B.
Eventually we can split the 1/n⁴ into four 1/n, each one will be put in front of a sum. So the inner sum will be:
1/n * sum 0 to n of [lenght(pair)] and the length of the pair can be described by the coordinates of the points. This will give us a Riemann integral if we let n tend to infinity. So we'll get the integral from 0 to 1 of the length(pair)dy_B . Then by doing the same with the other sums we will get the four integrals and dy_B*dx_B*dy_A*dx_A in the end.
Another way, and maybe an easier one too, is to see this it the following way:
Let be A the set of all points in the square (so [0,1]²), then A² is the set of all pairs of points in the square ( = [0,1]⁴).
Let be p in A² a pair of points. Let d be the distance function, so d(p) gives the distance between the two points that form p.
You see that we don't really talk about distance of two points (which are two objects), but length of a pair p (one only object) in A².
The average length in the square is then given by:
integral over A² of [d(p) (dμ)] (dμ defines the measure, not important for now, it's like the dx in a one-dimensional integral).
That's a result from probability. Actually it derives directly from the definition of the average in probability (in continuous spaces).
So you go over all A² and integrate the length. You can also take you variables x_1,x_2,y_1,y_2 to describe the points (x_1,y_1) and (x_2,y_2). So to go over all A² = [0,1]⁴, you can go for x_1 over [0,1], then for x_2 over [0,1], for y_1 over [0,1] and y_2 over [0,1], and your dμ will become dx_1*dx_2*dy_1*dy_2. So you'll get the integral that we looked for.
He glossed over all of the hard stuff not even trying to explain any of the hard stuff and went into super hard detail of all the stuff. This a great example of what not to do if you plan on teaching to somebody.
Did I figure it out? Who do you think I am? Stephen Hawking?
This is much lower level then Stephen Hawking
That wasn't really the point was it?
For many people, myself included, even though I'm actually rather good at math, integrals and differentials is advanced stuff.
Personally I've had the opportunity to learn at least, but there's simply too much to remember for my defective memory. It's not simply a matter of understanding the concepts, like with say trigonometry.
Felix Nielsen
For some people this level of problem is as "simple" as trigonometry (whether due to trigonometry being foreign or a comfort with calculus). You comparing this problem to Stephen Hawking level analysis insults all those that are ambitiously attempting to solve his standard problems but sometimes falling short.
It's like saying "everything you've done before is SO SIMPLE (and those that haven't gotten them are dumb)... but NO ONE can get this one because I can't. So stop teaching us and give us more problems that make me feel good about myself!"
In the end, I just found your opening post a bit insulting.
You're not listening. You made something big out of something small, and I explained why it is in fact objectively very difficult. That's that. There's nothing else to is.
Furthermore you proclaim that I'm insulting people, when nothing could be further from the truth. That in itself is an insult. You then go on to tell em what to do and not to do, and implying that I'm stupid.
You can't put it however you like. It is you who are in the wrong and it is you who have made an insult.
As for the problem, I have no issue with it on it's own, but asking "Did you figure it out?" as that is in anyway likely, is rather stupid I think, though that was not at all why I posted what I posted. It was simply a proclamation that I didn't have a chance in hell of figuring it out. I wouldn't even know what to Google for, and though you obviously will find it hard to believe, I am actually rather intelligent, I simply don't have the ability to remember a bunch of complicated formulas that have no use in everyday life.
Felix Nielsen
As a comparison, I found it fairly simple... so how would you like it if this was his standard difficulty (my guess is you wouldn't watch his videos then) and you still tried them to further your mind, but then at some point someone (me for an example) wrote "this puzzle is ridiculous!" even after he explained it.
You can take offence to my description or the fact that I called you out... honestly I don't care. I'm just trying to inform you that your comment could be taken offensively (although I was trying to do that discretely to begin with.. but you didn't seem to understand).
"did you figure it out?"
*HEEEELLLL NOOOO*
As an ECE student, i first thought how simple it is to just generate numbers and provide the average of distance. However, geometrically my initial thought was that we can draw a circle inscribed to the square so the majority of points are going to have an average distance of 0.5. I loved the integrations' solution and how helpful polar coordinates were.
Perfect video for the next time I teach a senior level probability course! I will make sure to read the top rated comments out during class for extra humor.
"I'm guessing it's about 0.5, but a bit off"
"This probably has some analytical solution I would not think of in a hundred years"
"Eh, just simulate the thing numerically"
True, I knew I couldnt solve that Problem but 5 lines of python and a 2-minute wait gave an even more accurate solution :)
What is your reasoning for the "a bit off" part, though?
@@gertoppermann9230 How many simulations did you do?
@@asiamies9153 I think for about 100 million. After that the average was steady enough that i concluded the result should be very close to the real answer, which was enough for me.
@@gertoppermann9230 okay
Did you figure this out?
Me: .... only part i figured out is i cant figure it out
I tried it in a very different way,...
I just calculated the average distance from one x1 to another x2 point, which is 0,36- ignoring y completly. This is very easy to do, just calculate the average of each point to another.
So for example if your x1 is 0, the average to a random x2 is 0,5 -> (0+0,1+0,2+0,3+0,4+0,5+0,6+0,7+0,8+0,9+1)/11 , go on with x1 is 1 and so on,
in the end it's ((0,5 + 0,418 + 0,354 +0,309 +0,281)*2 +0,272)/11 = 0,36.
Since this is a square, the average distance from one y1 to another y2 point is also 0,36.
Now we have an triangle with the points A, B and C.
The distance from A to B is 0,36 - the distance from A to C is also 0,36. We now have to figure out the distance from B to C - which is our end result.
So sqrt(2*(0,36^2)) = 0,513
which is kinda close to the result from this video.
I'm not very good in math, so I'm not quite sure why this isn't the exact same result. If someone can enlighten me, please do it!
Also sorry for my bad english, I'm from germany.
I think you're getting only an approximate value because x1 and x2 are continuous variables, i.e., they can take any value from 0 to 1, not just 0.1, 0.2, 0.3 etc, but also something like 0.123011345 and so on. You treated them as discrete variables, hence you get an approximation, which is close, but would improve if you included more values in the interval 0 to 1.
He basically just "integrated". But using a poor approximation. More points would (probably) give a better result, and the integral is exactly THE result.
I understood everything, except 4:04 and 6:50.
Imagine this question being asked in Computer science interview.
The Monte Carlo solution he showed first would probably be the correct answer in any CS interview.
Agree, keep iterating until the result stabilizes to the desired precision.
I guessed 0.5 at the beginning.... That totally counts ._.
I gussed a littlebit over 0.5 :D
Yeah, gut instinct lead me to .5 as well.
No, no it doesn't.
Just gonna guess sqrt(2)/2
Yh, I had no chance :P I can do integration for basic functions using rudimentary methods(IBP,u-sub etc), but chancing coordinates for a quadruple integral? Nah.
This was my guess too! Did you get this by starting from the 1 dimmensional version and putting that into the distance formula?
I estimated that by doing what you just said
But is it right? That was also my guess o/
I thought root(2)/2. What I did is I said: What's the maximum possible distance? Well that'd be 1 squared plus one squared and then the sqrt of that. So root(2) is the maximum distance. If the minimum possible distance is zero, just average them out. root(2) plus zero is root(2), then divide it by two.
I kind of figured it out... but, instead of paper and pencil, I wrote a Python program that generates 2 random points in the square, calculates the distance between them and then finds the average distance. It's amazing how it matches exactly the same value :)
I set up the quadruple integral and then let computer solve it for me :D
I rly love how the subtile always says something like, “Hey this is pressure Locker...”
You know? I really paused the video and went to try it myself. FOR FOUR YEARS.
Ok, i just actually worked on it every now and then. I knew it would come down to a complicated integral, but i wasnt very interested in that.
Actually, i was more interested in how many ways this could be approached, by geometric constructs, by intuition, by a "lazy statistical" approach, and of course, by programming a bunch of random points and averaging (though i wanted to leave this option to be the last as it would give me the number and interfere with my intuitive methods i was constructing)
I got some interesting results out of these methods, which im much more proud than the more precise number i got from the simulation and from the exact calculus.
Somehow i felt intuitively that the answer is 0.5...
the SAME
Me to!
nice, but it isn´t
if you model it with continuous uniform distribution thats the answer you ll get but its too simple unfortunately
+kotzzz9 since its assuming that the points are across a line rather than along a square
"We have now simplified the integral" I have no idea what's going on.
If the box size changes what happens to the average length? Fox example what is the average length between two random point in a 5X5 box and a 5x8 rectangle? Is the average length a linear solution as the box size increases?
Right, this went so completely far over my head that I don't even care at this point.
Yeah it relied on a lot of background knowledge. A university mathematics course helps, though you can always teach yourself. 3brown1blue channel has a load of great videos.
@@PaulSmith-pr7pv Which courses would be enough? calc 1, 2, 3?
You should have labeled this video with WARNING GRAPHIC VIDEO instead of very difficult.
My though procces (before seeing the vide, probably wrong lol)
-The maximum distance posible is the square root of 2, and the minimal is (in a proctical sense) 0
-There can be done an infinit amount of lines of sizes [square root of 2 to 0[
-Intuatively as smaller lines require less space to be put, there should be more small lines. But as the amount of any line is infinit, I’ll consider the amount of small lines to be equal to big ones. This logic aplies to everything in between, as the distribution should ve equal theought the possibilities.
-To simplifie the problem I’ll do the average distance in a circle of a diameter of 1:
- In this case as the max is 1 and the least is basically 0 the averige distance should be: (1+0)/2= 0.5. Also as the distribution of values should be equal above and bellow the average we can ignore those values.
-To answer the circle problem we can subtract the area of the circle to the area of the squre
Area of square = 1
Area of circle = 0.785398...
1-0.785398...= 0.214621...
I’ll treat this new area as a circle to get it’s average length
First I’ll calculate the diameter of it using a bit of algebra and the area formula (I’ll skip that part cause it’s kind of long, the diameter is:
0.26136160043...
Now, using the knowledge of how to get the average distance of a circle we can know that the average distance of this one is:
0.13068080021
So now we need to add this to the average length of a line in a circle (0.5)
0.5+0.13068080021= 0.6306808002
So my final answer is that the average length of a square of side length 1 is 0.63068080021...
Also, sorry for my grammar I’m not native English lol
Edit: I was wrong lol
How the fuck am i supposed to know how hard this is for regular people if its not written in the title?
you flip to the back pages in your Book of Life for the answers, duhhhh
I guess you have to watch the video while being a regular person
You should know by now this is a channel for smart people.
Thinking about it is a good exercise even if you don't come up with the answer yourself.
I was wondering what percent of population could easily follow. I could, but I bet only a tiny fraction could even do the polar coordinate transform.
I got till integration. But that jump of logic to convert x1,y1,x2,y2 to del x del y and then to polar coordinates was pure genius. But to be honest, I am rather pleased with myself for reaching as far as I did.
I love it..."Did you figure it out?".... I didn't have a clue ( ok ...I did follow the random number crunching method ) and have decided to just die in ignorance rather than try to grasp what the heck you did with those integrals.
This doesn 't look that hard
*sees solution*
What the f...
I have no idea why you made things so complicated and did not map this onto the 1D variant. Let E(delta(x)) denote the expected difference between two points chosen at random in the interval [0,1]. If you know this value, and use the fact that E(delta(x)) = E(delta(y)) for the 2D variant, then the answer is simply sqrt((2*E(delta(x)))^2).
***** The chance of randomly choosing two points in the [0,1] interval which lie distance 0 apart (i.e. exactly the same point, with infinite precision) is zero. Hence the expected difference -- which I called E(delta(x)) -- is definately > 0.
+AnotherBrickSPB
I watched the video just now and used exactly the same approach. Can you tell me why this is wrong if you have figured it out by now?
Yes I figured if you knew the average value of deltax and deltay then you can just put those into distance formula and get an average distance but I guess not. Still can't wrap my head around why it doesn't work and why it's a bit smaller than the actual answer
Then again if the same idea is applied to average distance between two points on a line then the formula for that is just |x1-x2| and the average value of x1 or x2 would be .5 which would make the average distance 0 which is wrong. It's harder to see where it fails in the square but seeing it fail on the line it's not surprising that it gives the wrong answer
Except it is not 0.5. The expected distance of a single point to 0 (or 1) is a half, but the expected distance of 2 random points *to each other* is a completely different number.
I had a similar problem given to me as an interview question for a job. You have a sheet of ruled paper and are given a pin that exactly fits between the ruled lines vertically. If the pin is randomly dropped from some height above the paper, what is the probability that the pin will straddle one of the ruled lines?
You seem to go from puzzles that are incredibly easy to ones that are nearly impossible.
I don't know the answer yet but would like to solve it for the circle (with a d=1) as well.
fellow bulgarian :?
r=1 *
I tried the spreadsheet method, for a circle of radius 1 or diameter 2, and i got about 0.72, so for a circle of diameter 1, from my calculations, it should be 0.36.
Not really sure 100%.
Hm, I tried something with MatLab and got 0.453.
I created to sets of Points with coordinates between -0.5 and +0.5 and then removed all points with a distance to the origin greater than 0.5. After that I calculated the distance between two points, one from each set, and took the mean. But maybe I'm wrong.
11011100DC Seems like you only used points a line (a diameter of the circle) and not the whole space of it
I love how he just put out all of the crazy math and he asked did you get the solution
That was an amazing solution. Thanks! I was looking for something much more mundane.
Wow. This sure was a good one. I have to admit, this was way beyond me. Do you think it would be a good idea to have like a difficulty rating at the start so that people with less classroom experience could pick out the ones which have emm... fewer quadruple integrals? I absolutely loved the video and that such a simple problem can have such a complex solution, but when the easier problems come along, I'm never sure if I want to even start in case it's like impossible.
His probability videos are truly amazing
7:30
Well
UUH
I would never thought of that.
The dreaded polar coordinates.
Brute force solution for n-dimensions in Javascript:
function averageDis(dimension) {
const iter = 10000000;
let a = [];
for (let i = 0; i < iter; i++) {
let sum = 0
for (let d = 0; d < dimension; d++) {
let d0 = Math.random(),
d1 = Math.random();
sum += (d1 - d0) * (d1 - d0);
}
a.push(Math.sqrt(sum));
}
return a.reduce((t, n) => t + n, 0) / iter;
}
@mindyourdecision, sir please help me understand the substitution at 4:22, I cannot find a derivation for it. Thanks in advance
I calculated it to be 0.527 from a different method. I was surprised I was off even though it was just by a bit. What I did was divide the triangle into 2 parts, 1 being 1 third and the other being 2 thirds. The average distance should be the max possible distance from the weight center of the square divided by two (aka all possible above half minus all possible under half). So it's sqrt (1^2 +(1/3)^2)/2 = 0.527
Mustang De Man efficient method well done
If u split the square by 106/300 and 194/300 u would’ve gotten 0.521
Mustang De Man how does the square root of "1^2" + anything equal to a number less than 1? Kids in Algebra 1 would prove you wrong.
Mustang....could you please elaborate the logic?...it sounds interesting 👏
The figure at 5:12 might be misleading. There has been a change of coordinates so that this square is not the x and y of the original square but deltax and delta y. Also tge triangular distribution can be considered by looking at the difference in scores between two dice. The maximum distance can be acheived in two ways (6,1)(1,6). The minimum distance in 6 ways(pairs). So the pdf of the distance decreases with distance. Thus for an x separation of 1 we require the chosen points x1,x2 at the extreme left and right of the square. with a pdf of zero. This is where the factor (1-x) comes from.
Why am I watching this? I have to wite a paper for college... and I don't even know how to math
I hear you. One time I binge-watched math videos to avoid studying for a physiology exam.
Ah good, so I'm not the only one.
Luckily you know how to English.
i don't even know how i got to this video why am i here
If it was a circle and not a square, would the answer be 0.5 ?
Jason Kaler I wonder that same thing.
Jason Kaler yes
No, it would be ~0.453 for a d=1 circle.
Robobrine why is that
+djahid abdelmoumen because I tested it? You can also do it mathematically and you'll get the same result, but it's just way faster to write a short program to calculate it.
For the why it's not 0.5: The chance of the points being closer together is higher than them being farther apart, so the result is
Side length = 1
Max length inside the square = diagonal (√2 or approx. 1.14)
Min length = 0
We then find the average of these two values.
Therefore, the answer is approx. 0.57. And that's the perfect answer.
Hetansh
What if it's a 1 by 1 by 1.... hypercube of infinite dimensions? What is the average length then? is it infinite?
that's creepy but it's a good question
Of course it isn't infinite. You will have a bounded region, and you are taking an average. There is no way it is going of to infinity...
Altum Novo the consensus online seems to be that as the dimension "n" goes to infinity the solution approaches sqrt(n/6), which would mean that the points would be "infinitely far apart," although this has no meaningful analog. This result is possible because an infinite dimensional hypercube is not "bounded space" in any conventional sense.
Yes unfortunately the average length for a hypercube of infinite dimensions is infinite because as long as 1 of the lines you can make inside the cube is infinite in length, then the average of all the lines has to also be infinite.
The longest line you can make in the object is sqrt(n) = sqrt(infinity) = infinity.
The hypercube of infinite dimensions all having length 1 is a very strange object, almost like an infintely spiky ball, a line from one side to the other equals 1, but going from corner to corner it equals infinity.
Altum Novo You know... Infinity isn't a number, right? So you can't use it like that in an equation.
It doesn't matter how many dimensions you have, it will still be a region defined as [0,1]^n, which clearly is bounded, so there is no way that the distance between 2 points is infinite.
Btw: The maximum distance between 2 points will be d=sqrt(n), which means that the average can't be infinity. It has to be less than d.
solved it using python
am i good at maths now?
He's better than you cuz he solved it in Excel.
No, I'd definitely choose Python over Excel.
The question is, did you run a big test and took the average, or actually calculated the math?
How many repetitions did you run, and how did you come up with the number of religions to run?
i calculated the average using 2000 small tests.
Square where sides each = 1. The greatest distance between points is the hypotenuse of a right triangle, corner to opposite corner. This right triangle has 3 known angles, & 2 known side lengths. 90/45/45. And 1 and 1. A(2) + B(2) = C(2). So 1(2) + 1(2) = 1 + 1. = 2. C(2) = 2. Hypotenuse = square root of 2. = 1.41421 . 1.4 for simplified illustration purposes. The least distance being just > 0. Divide 1.4 by 2 = "average" = 0.7 .
Tough one. 👍. It will be interesting to know, the average distance between points across circle and regular n sided figures. How about a cube?
I concluded 0.6 in a (less than) 10 second estimate... close enough for a lazy man.
integrate (x-a)**2 + (y-b)**2 dx dy da db from 0 < x < 1 and 0 < y < 1 and 0 < a < 1 and 0 < b < 1 this is how I did the problem which gave 1/3 which is actually really close, can you spot the reason why it is incorrect. I know it computes the lengths twice but it doesn't matter since the integral is symmetric, to get the average, you divide by the area which is simply one so that doesn't change the answer.
"Did you figure it out?"
Me: "Absolutely not!"
"Did you figure it out?"
FUCK no.
The distance between random points on a CIRCLE with area 1 is about 0.592. You have to use cylindrical coordinates and use the cosine rule.
Matlab code:
r1 = rand(100000,1)*1/sqrt(pi);
r2 = rand(100000,1)*1/sqrt(pi);
th1 = rand(100000,1)*2*pi;
th2 = rand(100000,1)*2*pi;
for i = 1:length(r1)
d(i) = sqrt(r1(i)^2 + r2(i) - 2*r1(i)*r2(i)*cos(th2(i)-th1(i)));
end
avg = mean(d)
"give this problem a try and..." i was like , how to start
07:30 is that a rhetorical question 😂
An easy and quick way can be done by considering 2 sqr triang. of side 1 & 1/n, and 1/n & 1/n, they will look after the slanted and parallel lines respectively. We will not use integrals but only sums (only approx. value will be enough). after simplifying we have: 1/4(Sum from n=1 to n=inf. of 1/n), we then calculate for only the first four values:
1/4(1+1/2+1/3+1/4)=1/4(2.0833)=0.5208
if we express that with only three decimal places, we have 0.521
Just use analitical geometry and make it so x+y=1. And (x1 - x2)squared + (y1 - y2)squared = (the result)squared. It's literally pitagorium, sorry for the awesome english, I am black.
Oh shit, he did that. Well goly, was that a waste of time... Oh boy, time to get the rope ready.
wait why would x+y=1
Because penguins don't play D&D. Do I have to explain everything to you Floradragon? ;)
hockey player or emperor?
*jumpscare warning*
If you haven't watched the video
Just go to 4:28 to have a jumpscare
?
wha
What you're doing at 1:00 is something arbitrary we learned in high school that I never really figured we'd use. But if you're playing Minecraft and trying to find the distance between 2 spawners for a mob farm, you have to do this exact same thing but with a 3rd dimension. Fortunately you can solve one plane at a time, but it's still a fair amount of work
"Did you figured that out?"
hmmm...dafuq?