Wikipedia:Reference desk/Archives/Mathematics/2012 March 18

From Wikipedia, the free encyclopedia
Mathematics desk
< March 17 << Feb | March | Apr >> March 19 >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


March 18[edit]

Infinite sum[edit]

Please solve the following:

where pn is the n-th prime number. 113.178.27.141 (talk) 05:11, 18 March 2012 (UTC)[reply]

Please do your own homework.
Welcome to Wikipedia. Your question appears to be a homework question. I apologize if this is a misinterpretation, but it is our aim here not to do people's homework for them, but to merely aid them in doing it themselves. Letting someone else do your homework does not help you learn nearly as much as doing it yourself. Please attempt to solve the problem or answer the question yourself first. If you need help with a specific part of your homework, feel free to tell us where you are stuck and ask for help. If you need help grasping the concept of a problem, by all means let us know. --Trovatore (talk) 05:26, 18 March 2012 (UTC)[reply]
This is telescoping series. The answer is . You can prove that inductively, and the reason is because all the terms cancel except the first and last. . Widener (talk) 06:18, 18 March 2012 (UTC)[reply]
Did you not agree that this looked like a homework question, or are you deliberately going against the accepted practice? --Trovatore (talk) 06:27, 18 March 2012 (UTC)[reply]
"If you need help with a specific part of your homework, feel free to tell us where you are stuck and ask for help."
He did tell us were he was stuck, any further, he would have solved it ;-) Besides, unless he copy/pasted, he did make the effort to use math notation, may have taken some time to figure out. 84.197.178.75 (talk) 11:11, 18 March 2012 (UTC)[reply]
It is not a good thing to just give people the answer. Word will get around and we'll be inundated with this sort of request. Seriously, people. Just don't do it. --Trovatore (talk) 13:02, 18 March 2012 (UTC)[reply]

I (the asker) know the answer, I just want to verify it. 27.69.119.45 (talk) 06:49, 19 March 2012 (UTC)[reply]

Oh. Well, in the future, you might state that upfront, and include your answer as well. That way it won't look like homework. --Trovatore (talk) 06:53, 19 March 2012 (UTC)[reply]

Minesweeper[edit]

Here is a position from Minesweeper. I am interested in the probability of hitting a mine when clicking a square. The probability when clicking one of the 8 squares around the "2" are 2 in 8 or 0.25. Around the "1" square it is 1 in 8 or 0.125. But what about the three squares that are common to both groups? Obviously, one can count all the possible permutations of positions of mines and determine how many have mines occuring in the overlap, but is there an analytical method of doing this?

Also, my results from the brute force counting method is 15/65 (=3/13) permutations have mines in the overlap. The probability of hitting a mine if all three are clicked is 3/13. Since there is only one mine in the overlap, the probability of hitting a mine from one click is one third of this, 1/13 ≈ 0.08. Is this right? It is very counter-intuitive; I was expecting a figure between 0.125 and 0.25. It means that clicking in the overlap between already discovered mines is safer than clicking in the non-overlap and way safer than clicking a random blank area (mine density ~ 0.2). SpinningSpark 19:22, 18 March 2012 (UTC)[reply]

That is a bit surprising. By the way if you know there are 18 mines in total with that then there is a zero chance of there being a mine in the overlap :) Dmcq (talk) 23:58, 18 March 2012 (UTC)[reply]
If you have a density of 0.2 then you have to really work out the most probable configurations. For a group of 5 cells the chances of 0 filled is 0.85, of 1 is 5×0.2×0.84 and of 2 is 10×0.x2×0.83, . for the three in the middle the chance of 0 is 0.83 and 1 is 3×0.2×0.82. So the chance of getting one of the 2 0 1 configurations of which there are 10×1×5 is (10×0.22×0.83)×(5×0.2×0.84) and of a 1 1 0 configuration of which there are 5×3×1 is (5×0.2×0.84)×( 3×0.2×0.82). That comes out as 0.0839 for the first and 0.1573 for the second or 2.3593 of the second for 4.1943 of the first that gives a chance of 0.36 of one of the 3 centre ones being filled or 0.12 for each of them. That's considerably more than the 1/13 or 0.077 of your calculation but still less than the 0.128 chance of clicking on a mine in the other 5 squares around the second empty cell. Dmcq (talk) 00:26, 19 March 2012 (UTC)[reply]
I think it's a bit unfair to compare your computed probability with the mine density ~ 0.2, since your computation doesn't make use of this density. If we assume that these 30 squares contain exactly 6 mines, there are 20475 ways of having one mine in the overlap (6825 for each square) and 22750 ways of having no mines in the overlap, and hence the probability of hitting a mine if clicking on one square in the overlap is 6825/(20475+22750) ≈ 0.16. You could get a better answer by not fixing the number of mines and weighting each possibility by its probability of occuring, but I don't have the time to do that right now. 60.234.242.206 (talk) 00:43, 19 March 2012 (UTC)[reply]
I would think that the problem does not permit proper analysis without some a priori knowledge/assumption of the distribution/number of mines. For example, if there are exactly two mines, there is a 100% probability of exactly one mine being in the overlap. AFAIK the player always is given the total number of mines. By analyzing different numbers of mines, one could look for a general pattern, but already one can see that the number of mines has a major impact on the probability in the overlap and cannot be omitted from the analysis. — Quondum 05:47, 19 March 2012 (UTC)[reply]
I see the point about mine density affecting the outcome. However, I don't think the way it has been used by Dmcq can be right. For the 13 squares of interest, the mine density in that local area must be either 2/13 or 3/13. The expectation value must rise from 2/13 as the global mine density increases, but can never go above 3/13 even if the global density approaches 100%. Experimenting with a mine density of 149/(24x30) it does seem to be remarkably safe to click in the overlap of this "2+1" position - although I may not have done enough tests to be statistically valid - so the result from 60.234 does not appear to be valid for larger grids. SpinningSpark 08:32, 19 March 2012 (UTC)[reply]
Yup, one mine in the overlap varies all the way from 100% (2 mines total) to 0% (18 mines total), varying oppositely with density. Dmcq's approach assumes each cell has a mine placed with a fixed probability, uncorrelated to other cells, with no set total number of mines. This is equivalent the limit of a large board size for a specified proportion of the cells being filled, each mine placed randomly (uniform probability over those not yet filled). I think one thing was skipped by Dmcq though: the effect on the probability of the configuration of the all-empty set of cells. So (by my reckoning) the 2 0 1 configuration has a probality of (10×0.22×0.83)×(1×0.20×0.83)×(5×0.21×0.84) = 0.0429..., and the 1 1 0 configuration has a probability of (5×0.21×0.84)×(3×0.21×0.82)×(1×0.20×0.85) = 0.0515... The relative probability of 2 0 1 : 1 1 0 is then the ratio of these, 5 : 2, i.e. the probability of hitting a mine in any one of the overlap cells is (2/7)/3 = 2/21 = 0.0952... This is definitely lower than the "local density" of 2/13 or 3/13. Increase the density and I expect you'll find the probability dropping more, as per my earlier statement, using this formula with a varying the density. Something seems not right here, anyhow I must still look closer. — Quondum 09:54, 19 March 2012 (UTC)[reply]
Oh yes you're right, that was very silly of me. Shows how wrong one can be if you look at something just as you're going to bed. Dmcq (talk) 12:55, 19 March 2012 (UTC)[reply]
In the crossed out bit I think the ratio is 5:6 so probability of hitting a mine is (6/11)/3 = 2/11 = 0.1818... Dmcq (talk) 13:08, 19 March 2012 (UTC)[reply]
Shouldn't you start from the given densities 2/8 (around 2) and 1/8 (around 1), and then calculate the chance of 2 or 3 mines? 84.197.178.75 (talk) 10:35, 19 March 2012 (UTC)[reply]
That was effectively what I did to get my p=0.08 result. Apparently there is something wrong with that method. SpinningSpark 10:45, 19 March 2012 (UTC)[reply]
I did a simulation, and it seems it matches my figures. Out of 106 games, each cell with a probability of 0.2 of having a mine, the number of times a 2 0 1 configuration occurs was 42662 and a 1 1 0 configuration was 51613 (given that the exposed cells have no mines; multiply by d2 without the given). The probability of hitting a mine in a shared cell is 1/3 ⋅ 51613/(51613+42662) = 0.1825 Analytically, I expect a probability of (1−d)/(3+7d), and with d=0.2 this is 0.1818. Combine this with the expression's expected limiting behaviour at d=0 and d=1, I'm gaining confidence in my treatment. — Quondum 12:45, 19 March 2012 (UTC)[reply]
I should have read further down to here. A bit of algebra, what a good idea ;-) Yep I fully agree with your figures. Dmcq (talk) 13:12, 19 March 2012 (UTC)[reply]
By the way if d is 0.5 then the chances are 1/13, the same as the original analysis. Dmcq (talk) 14:14, 19 March 2012 (UTC)[reply]
You can do an exact calculation: if you play an easy game, you've got 10 mines and 81 squares, possible comb with 3 mines is , with 2 mines is ; gives you a chance of 0.687 that there's a mine in between. Medium difficulty it's 0.619; For Expert setting, it would be about what Quondum calculated. 84.197.178.75 (talk) 14:36, 19 March 2012 (UTC)[reply]
And that approach can eb extended to show that on an actual board with N cells and M mines with just those two squares showing the chances of hitting a mine if you click on one of the three centre squares is (N-M-12)/(3N+7M-56) which adjusts that density formula for an infinite board.
A thing that puzzles me, is there any good reason that the infinite board with density 1/3 gives a chance of 1/8 of hitting a mine if you click on one of the three centre square - i.e. it makes no difference which square around the one you click? Dmcq (talk) 16:20, 19 March 2012 (UTC)[reply]
I had another look at this and there's something you can use for more general cases, it's a nice easy rule so I wouldn't be surprised if it is already common knowledge amongst dedicated minesweepers. If you have two empty cells showing with A in one and 1 in the other and they share K cells in common, 3 in the above case but it could be 1 or 2, then if the density of mines on a large board is A/(9-K) it makes no difference which cell you choose around the 1 cell. Therefore you should choose one of those shared cells if the density is more than that. Dmcq (talk) 20:32, 19 March 2012 (UTC)[reply]

Cominatorics question[edit]

in how many ways can i arrange numbers 1,2,3,4,5,6 such that number one 1 isn't in the first position, number 2 isn't in the second. number 3 isn't in the 3rd position... --Thepurplelefant (talk) 19:50, 18 March 2012 (UTC)[reply]

See derangement. Bo Jacoby (talk) 20:02, 18 March 2012 (UTC).[reply]

i didn´t understand, i just want the answer. --Thepurplelefant (talk) 20:14, 18 March 2012 (UTC)[reply]

What is the use of an answer which you do not understand? You will find the answer (265) in the article if you care to read it. Write down all the 720 permutations of 1,2,3,4,5,6, and overstrike the ones where 1 is in the first position or 2 in the second or &c. Count the remaining ones. It is hard work, but you don't need advanced math. Bo Jacoby (talk) 20:30, 18 March 2012 (UTC).[reply]
The article does contain a relation which you can use to calculate the number of such permutations (derangements):
!1 and !2 are easily derived intuitively:
(in a sequence with one element, there is no way of avoiding putting the first element in the first position)
(in a sequence with two elements, there is exactly one permutation which avoids putting the first and second elements in order)
(follows from the above relation)
--NorwegianBlue talk 21:05, 19 March 2012 (UTC)[reply]

Latex question[edit]

I would like to write a function, and place "plus" or "minus" signs under each variable to indicate the sign of the function's partial derivative with respect to that variable.

I can't figure out how to do this properly in Latex. Currently I'm doing it using arrays, turning each variable into a 2 by 1 matrix and putting the sign in the lower entry. But this means the signs have to go inside the enlarged brackets and everything's spaced out too much, and it doesn't look like I want it to.

For example, with , I just want to place the plus or minus symbols under the a,b and c, but not have them included inside the brackets, and not have the "f" out of line with the a, b and c. — Preceding unsigned comment added by Thorstein90 (talkcontribs) 22:43, 18 March 2012 (UTC)[reply]

Is this what you want?
SpinningSpark 23:00, 18 March 2012 (UTC)[reply]
Yes, that's exactly what I want! I didn't know about \underset. Thanks for your help! — Preceding unsigned comment added by Thorstein90 (talkcontribs) 23:31, 18 March 2012 (UTC)[reply]
Related command that you may enjoy: \underbrace lets you do stuff like this:
SemanticMantis (talk) 13:30, 19 March 2012 (UTC)[reply]