Why can you in physics exercises neglect the effect of air drag in case of basketball but not in the case of ping pong ball?

I think it makes sense to approach it by comparing forces. You through your ball, be it ping-pong or backetball and then you want to know how it flies. Lets work in 2d. The trajectory of your ball will be given by two functions: $\{x\left(t\right),\,y\left(t\right)\}$, i.e. horizontal and vertical position, where $t$ is time.

You start of with initial conditions. The position of the ball at $t=t_0$: $x_0=x\left(t_0\right)$, and $y_0=y\left(t_0\right)$. And its initial velocity: $\dot{x}_0=\frac{dx}{dt}\left(t_0\right)=\dot{x}\left(t_0\right)$, and $\dot{y}_0=\dot{y}\left(t_0\right)$.

To find the trajectory you then need governing equations, your forces: gravitational $F_g$ and drag $F_d$. Plugging it in, for horizontal you will have:


Where $m$ is mass, and $\alpha$ is constant (I took drag to be proportional to speed to a fixed power $k$). For vertical we will have:


You are free to solve these equations fully, instead you can try to do a simplification. Lets say your time of flight is $T$, and lets say that values of horizontal and vertical positions are roughly $L$. Then the typical magnitude of $\dot{x}\sim L/T$ etc.

We then argue that the drag term can be left out of the equations of motion, i.e. ignored, if $\frac{\alpha}{m}\ll \frac{T^k}{L^k}$. Basically we estimate the rough numerical value of all the terms in the equation and throw out the smallest ones.

For a fixed trajectory and size of the ball (same $\alpha$, $L$, and $T$) this can be achieved if $m$ is large.

So for a heavier ball, given the same volume and trajectory/time of flight, drag will have smaller effect.

Let's start by looking at the equation for drag force: $$F_{D}=\frac{1}{2}\rho v^2C_dA,$$

where $\rho$ is the density of air, $v$ is the speed of the object, $C_d$ is the drag coefficient (it is usually ~0.47 for spherical objects and measured in experiments) and $A$ is the surface area of the object. For argument's sake, let's say the basketball and the ping-pong ball are both at the same velocity, then only the different surface areas lead to a difference in drag forces. Let's say the radius of a ping pong ball is 2 cm, and the radius of a basketball is 10cm. This means the basketball will feel a drag force that is 25 times greater!

However, to really judge the effect of the drag force, we need to compare the magnitude of the drag force to the force it is opposing, which is the weight: $$ F_{W} = mg, $$ where m is the object's mass, and g is the gravitational constant.

A ping-pong ball has a mass of 0.0027 kg, a basketball has a mass of 0.63 kg. This means the weight of a basketball is approximately 230 times larger! Now, to compare the effect of drag on a ping-pong ball to the effect of drag on a basketball, we can evaluate the following ratio:

$$ \frac{F_{Dping}/F_{Wping}}{F_{Dbask}/F_{Wbask}} $$

If this ratio is much bigger than 1, the effect of drag is much greater on the ping-pong ball. If this ratio is much smaller than 1, the effect of drag is much greater on the basketball. Let's substitute $F_{Dbask} = 25F_{Dping}$ and $F_{Wbask} = 233F_{Wping}$:

$$ \frac{F_{Dping}/F_{Wping}}{25F_{Dping}/233F_{Wping}}. $$

Cancelling the variables, we get $233/25$ - the effect of drag on the ping-pong ball is approximately 9 times greater than the effect of drag on the basketball!