# Hypothesis testing - why $P(X \geq x_0 ; H_0)$ and not $P(X = x_0 ; H_0)$?

In a few of my statistics classes, I was taught that the procedure for carrying out a hypothesis test for a statistic $X$ with observed value $x_0$ is to determine the distribution under the null hypothesis $H_0$, and to compute the probability $P(X \geq x_0)$ (or $P(X \leq x_0)$, etc, depending on the test) under the null hypothesis, and to reject the null hypothesis if this probability is too small.

However, I've always wondered why we compute $P(X \geq x_0)$ rather than $P(X = x_0)$, since as I understand it, what we're interested in is the probability that we observe that particular result $x_0$ by chance.

The only explanation I've heard so far is that it's not possible to compute $P(X = x_0)$ if $X$ follows a continuous distribution, but this doesn't explain the case where $X$ follows a discrete distribution, and it doesn't seem like a satisfactory explanation even in the continuous case.

So why do we compute $P(X \geq x_0)$ rather than $P(X = x_0)$?

-
Let $X$ be a random variable with continuous distribution on some interval. Then for any $x_0$ in that interval, $\Pr(X=x_0)=0$. Thus at any significance level, we would end up rejecting the null hypothesis with probability $1$.
Analogous issues arise with discrete problems. Suppose that we are testing the hypothesis $H_0$ that a coin is fair. Imagine tossing the coin $100000$ times. Suppose we get exactly $50000$ heads. Surely we would not want to reject the hypothesis that the coin is fair!
However, the probability of exactly $50000$ heads in $100000$ tosses of a fair coin is about $0.0025$. So, given the hypothesis of fairness, what we have observed is a quite unlikely event.
Let us look at the issue from another point of view. Suppose again our null hypothesis is that the coin is fair. We plan to toss the coin $400$ times. We will abandon the null hypothesis if the number of heads or tails is "too far" from $200$. Now if $225$ heads or tails is "too far," then $230$, or $240$, is even better reason to reject the null hypothesis. So it seems reasonable to set a distance $d$ such that if $|N-200| \ge d$, where $N$ is the observed number of heads, we will reject the null hypothesis.