Solution (source code)

= Solution
{c}

The sign of $T_{ab}X^aX^b$ is unchanged by a nonzero rescaling of the <timelike vector> $X$. Normalize it to a <four-velocity> $W$ and, after reversing its direction if necessary, write $W=\gamma(u+w)$, where $u\cdot w=0$, $w\cdot w=s\in[0,1)$ and $\gamma=(1-s)^{-1/2}$ is the <Lorentz factor>. For the <perfect fluid in general relativity>,
$$
T_{ab}W^aW^b=(\rho+p)\gamma^2-p
=\rho+(\rho+p)(\gamma^2-1).
$$
Taking $W=u$ requires $\rho\ge0$. Allowing the <Lorentz factor> to become arbitrarily large requires $\rho+p\ge0$; otherwise sufficiently fast observers measure a negative value. Conversely, these two inequalities make both terms in the last expression nonnegative. Therefore the <weak energy condition for a perfect fluid> is exactly
$$
\boxed{\rho\ge0,\qquad \rho+p\ge0.}
$$
Property (1) is the <weak energy condition>: \b[every physical observer measures nonnegative local <energy density>], namely $T_{ab}W^aW^b$ for their normalized <four-velocity> $W$. It allows negative <pressure> down to $p=-\rho$.