sin and cos can be used to find the x and y coordinates of an angle where the hypotenuse is known (in this case the hypotenuse would be the distance the ball moves).
If you visualize a ball moving 1 unit at a forty five degree angle, you can see that it ends up at (x+nx, y+ny). You need trig to find nx and ny, which shift the ball at the correct angles, the equations given by Disch is how to find nx and ny (xvel and yvel as he puts it). The equation will work for any angle.