but I don’t understand the math of how to get that answer
There’s four total outcomes of the problem:
Scenario 1: you originally pick the winning door (1/3) and don’t switch (1/2), therefore winning. Probability = 1/6
Scenario 2: you originally pick the winning door (1/3) and did switch (1/2), therefore losing. Probability = 1/6
Scenario 3: you originally pick a losing door (2/3) and don’t switch (1/2), therefore losing. Probability = 1/3
Scenario 4: you originally pick a losing door (2/3) and do switch (1/2), therefore winning. Probability = 1/3
Now consider scenarios 1 and 3 together, these two are when you don’t switch. P(S1) is 1/6 and P(S3) is 1/3, meaning S3 is twice as likely than S1. So if you don’t switch, you are twice as likely to lose. And now consider scenarios 2 and 4 together. P(S4) is 1/3 and P(S2) is 1/6, meaning if you switch you are twice as likely to win than to lose.
You can also consider this problem in terms of conditional probability like this:
P(win as long as no switch) = P(win and no switch) / P(no switch) = P(S1)/(1/2) = (1/6)/(1/2) = 2/6 = 1/3
P(win as long as switch) = P(win and switch) / P(switch) = P(S4)/(1/2) = (1/3)/(1/2) = 2/3
P(win as long as switch) > P(win as long as no switch)