Probability of drawing a heart and then an even number, without replacement, from a deck of cards I had an algebra student I know ask me an interesting question: What is the probability of drawing a heart out of a deck of cards, and then drawing an even number right after it?
Clearly, the probability of drawing a heart out of the deck is 13/52, or 1/4. The probability of drawing an even number as card #2 ($c\in\{2,4,6,8,10\}$) for any suit is 20/51, except when the first card drawn is an even heart, then the probability of the second draw is 19/51.
I wish it were as simple as $ P(E|H) = \frac{P(E\cap H)}{P(H)} = \frac{\frac{5}{52}}{\frac{13}{52}} = \frac{5}{13} $.
My Monte Carlo simulation I wrote to simulate this process does not match: I get something in the neighborhood of 9-10% from the code I wrote. Where is my logic faulty?
import java.util.Random;

public class CardCounter {

    /**
     * @param args
     */
    public static void main(String[] args) {
        int heartThenEvenCount = 0;
        int cardsNotEqualCount = 0;

        for(int i = 0; i < 1000000; i++) {
            Random r = new Random();

            int card1 = r.nextInt(51) + 1;
            int card2 = r.nextInt(51) + 1;

            /* Assume that 1-13 are hearts
            Ace = 1
            King = 0
            Queen = 12
            Jack = 11
            Other numbers as they are written on card. */

            //Make sure the cards are not the same
            if(card1 != card2) {
                // Check to see if the first card is a heart.
                cardsNotEqualCount++;
                if(card1 <= 13) {
                    // Check to see if the second card is even, but not a face card.
                    int card2Rank = (card2 % 13); 
                    if(card2Rank > 0 && card2Rank <= 10 && (card2Rank % 2) == 0) {
                        heartThenEvenCount++;
                    }
                }
            }
        }
        System.out.println(heartThenEvenCount + " / " + cardsNotEqualCount);
        System.out.println(heartThenEvenCount/(double)cardsNotEqualCount);
    }
}

 A: I don't know what the heck your "wish it were as simple as" analytical calculation is supposed to be, but you have already laid out the pieces, and just need to combine them properly.  Use the law of total probability and break down (condition on) whether the 1st card heart is not an even number or is an even number.
So P(1st card is heart and 2nd card is an even number) = P(1st card is heart and not an even number) * P(2nd card is even number given 1st card is not an even number) + P(1st card is heart and is an even number) *  P(2nd card is even number given 1st card is an even number) = $(8/52) (20/51) + (5/52) (19/51) = .0961538...$ which is in the 9 to 10% neighborhood you say your simulation provided.
A: You probably need the law of total probability. For clarity, let's denote the following events:
\begin{align}
& A = \{\text{the first drawing is a heart}\}, \\
& B = \{\text{the second drawing is an even number}\}, \\
& C = \{\text{the first drawing is an even number}\}.
\end{align}
The probability of interest is $P(A \cap B)$, which is $P(A)P(B \mid A)$. Clearly, as you stated $P(A) = 1/4$. To find $P(B \mid A)$, by law of total probability,
\begin{align}
P(B \mid A) & = P(B \cap C \mid A) + P(B \cap C^c \mid A) \\
& = P(B \mid C \cap A)P(C \mid A) + P(B \mid C^c \cap A)P(C^c \mid A).
\end{align}
It is straightforward to verify that
\begin{align}
& P(C \mid A) = \frac{P(A \cap C)}{P(A)} = \frac{5/52}{13/52} = \frac{5}{13}, \\
& P(C^c \mid A) = \frac{P(A \cap C^c)}{P(A)} = \frac{8}{13}, \\
& P(B \mid C \cap A) =  \frac{19}{51}, \\
& P(B \mid C^c \cap A) = \frac{20}{51}.
\end{align}
Thus $P(B \mid A) = \frac{255}{663}$, and the final answer is $255/2652 =  0.09615385$.
A: Drawing a heart on the first card and drawing an even number on the second card are independent events, so the answer is just the product of the individual probabilities.  Drawing a heart is 1/4 and drawing an even number is 5/13, so the answer is 5/52 = .0961538...
