# Calculate Mind Funeral efficiency

I was wondering about the formula on how to calculate the average number of cards milled by Mind Funeral.

Target opponent reveals cards from the top of his or her library until four land cards are revealed. That player puts all cards revealed this way into his or her graveyard.

Just to have an example scenario, let's assume it's an EDH/Commander deck (99 cards total) with 40 lands in it. With no mana ramp or extra draws, let's assume we had the first turn and can cast Mind Funeral on turn 3. Target opponent should have 90 cards left in his library at that point.

• No formula but someone simulated it (for 60-card decks with 19-26 lands) and posted the results in a Gatherer comment. gatherer.wizards.com/Pages/Card/… Mar 17 '17 at 14:25
• I would reword your question so that it requires zero knowledge of MTG, and then ask on Mathematics Stack Exchange. It's totally on topic here of course, but I think you would get a better answer there. Mar 17 '17 at 14:43
• If you're okay with an approximation, modeling it as a hypergeometric distribution would give you a nice(-ish) formula. The draw without replacement means it's not exactly right. Mar 17 '17 at 14:54
• The other benefit of asking on a math site is they can actually show math in their answers, because they have mathjax enabled :-/ I can answer this, but writing an answer clearly is hard.
– Cascabel
Mar 17 '17 at 15:43
• These kinds of questions are almost always better done through simulation. The simulation pointed to by Michal Politowski is very enlightening, and reasonable. I think that should be made into a real answer.
– John
Mar 17 '17 at 15:56

This situation can be approximated by the following model: you have an infinite sequence of lands and non-lands, where the probability P that each is a non-land is equal to the fraction of the deck that is non-lands. So, in a 60 card deck with 36 non-land cards, we say P=3/5.

Now, starting at any point in the sequence, the probability that we see exactly N non-land cards followed by a land is simply P^N * (1-P). From there, to get the expected number of non-lands followed by a land, we calculate

Sum {for all N} of N * P ^ N * (1 - P)


The 1 - P factor is independent of N, so that's the same as

(1 - P) * Sum {for all N} of N * P ^ N


This is then equal to (see Wolfram|Alpha)

(1 - P) * P / (1 - P) ^ 2 = P / (1 - P)


So, the expected number of cards that we mill when we mill until we see one land is 1 + P / (1 - P) (adding 1 to also count the land)

Then we simply multiply that by the number of lands that we mill until.

If we apply this to Mind Funeral targeted at a 60 card deck with 24 lands, or at a 100 card deck with 40 lands, in either case about 3/5 of the deck is non-land, so the expected number of total cards milled is

4 * (1 + (3/5) / (2/5)) = 4 * (1 + 3/2) = 10


We expect to see 10 cards milled from a deck that is about three fifths non-land.

There is a little simplification we can apply to the formula above, based on information we can infer from the initial definitions. Specifically, P is the fraction of the deck that is non-lands, or in other words non-lands/(total cards). And 1-P is the faction of the deck that is lands, so that's lands/(total cards). Then

1 + P / (1 - P)
= 1 + (non-lands/total) / (lands / total)
= 1 + non-lands / lands
= (lands / lands) + (non-lands / lands)
= (lands + non-lands) / lands


And of course the number of lands plus the number of non-lands is just the total size of the deck. So, the overall formula for the expected number of cards that you mill is

(lands to mill) * (library size) / (lands in library)


or, perhaps more clearly

(library size) * (lands to mill) / (lands in library)


In other words, the fraction of the library we expect to mill is approximately equal to the fraction of the remaining lands that will be milled.

• This turns out to be quite close to the actual answer.
– Cascabel
Mar 17 '17 at 16:01
• Good, that probably means I did the math right. This approximation should be close enough that the difference doesn't matter as long as the number of lands remaining in the library is significantly larger than the number of lands you have to mill. Mar 17 '17 at 16:15

The average is 400/41, approximately 9.76. In general, if you have a deck of size d containing l lands and you mill until you hit m lands, the average is (1+d)t/(1+l).

The math here is actually pretty simple. To mill n cards, you have to have 3 lands in the top n-1 cards, a land at position n, and 36 lands in the bottom 99-n cards. So there are binomial(n-1,3)*binomial(99-n, 36) ways for this to happen, out of binomial(99,40) total positions for the lands, and the probability p(n) is the ratio of the two.

(The binomial coefficients are 0 when this is impossible, e.g. when you're trying to cram 36 lands into the bottom 10 cards because you only put 4 in the top 89.)

To get the expected value, you just sum n*p(n). You could get the approximate version with your choice of calculator/software. Mathematica gives the exact solutions as above.

(Apologies, I don't know a better way to write binominal coefficients than binomial here, and I haven't had time to work out an actual proof.)

• I assume that in this answer, 400 is not a constant, but rather something like 4 * library size. So, in other words, I'm guessing that your formula is something like number of lands to mill * number of cards in library / (number of lands in library + 1). Mar 17 '17 at 16:21
• In contrast, I think the formula in my answer works out to number of lands to mill * number of cards in library / number of lands in library. Mar 17 '17 at 16:22
• @murgatroid99 Yes, the general form does appear to be what you said, with a +1 in the numerator too but I don't have a proof so I didn't add it yet.
– Cascabel
Mar 17 '17 at 16:48