A Piece of Mathematics from MTG
Yesterday my friend Alex brought to my attention a maths question which could fall out of a game of Magic the Gathering. I'm going to write about this so it should be understandable even if you haven't played the game. The question comes from this card from years ago:
Let's say you have that card on the field, but it itself unable to attack for some reason. To start off with an easier version of the problem, let's assume you have n creatures with 1 power each on the field alongside the Maw of the Obzedat. If they were all to attack the other player then each creature would do 1 damage, for a total of n damage.
However if you used the Maw's ability once then you would have n-1 creatures each doing 2 damage. This gives a total of (n-1)*2 damage which is probably more. By sacrificing more creatures we can have the remaining ones have higher and higher power and so they should be able to push through more damage overall. However there is a payoff here which can be seen if you take it to the extreme; if you sacrificed all of your creatures then you would get no damage through. The question becomes: how do we maximise the damage?
Let's say we sacrifice k creatures, then necessarily k is somewhere between 0 and n (inclusive). That means that each creature will have k+1 power and you will have n-k of them giving a totaldamage of (k+1)(n-k). This expands to n-k+nk-k^2. If we try to maximise this then we can differentiate with respect to k and set the result to 0. This gives -1+n-2k=0 which we can solve for k=(n-1)/2. This is the number of sacrifices which maximises the damage.
However this number is not always an integer. If n is odd then it is fine, but if n is even then you can take either of the numbers a half bigger or a half smaller from this and it will work (the whole thing is symmetrical).
What about if we change the situation from n 1/1s to n x/xs? Well actually not much differs. The total damage for this is (k+x)(n-k) which gives a maximum when k=(n-x)/2 which is basically the same.
I've been thinking about more general solutions to these situations. If you had a general field of some creatures with different powers then it would be nice to get a closed form for the answer, but it gets surprisingly messy. Instead Alex suggested a useful work around for when you actually play. You can order all of your creatures from lowest to highest power and start sacrificing from the lowest. Each time you only have to compare the power of your lowest creature with the number of other creatures that you control. While it is lower you should keep sacrificing, but as soon as it isn't you should stop. This method guarantees hitting the maximum damage.