It’s been a while since high school physics (in which I got an A, if I recall ;))
Let’s take a muzzle velocity of 425 meters/sec (handgun), but it should be the same for any velocity:
Note: these calculations don’t take into account air resistance, earth curvature, wind, etc. etc.
Shot straight up, it’ll take t seconds to reach a velocity of 0 m/s (where it stops going up and starts going down)
t = v/g
v is initial velocity (425m/s) and g is gravity (9.812865328m/s/s)
t = (425m/s) / (9.812865328m/(s^2))
t = 43.31048942s
And another t seconds to come back down. (This time v would be final velocity)
Total time = 2t = 86.62097885s
Now, distance traveled in that time is average velocity (1/2* 425m/s = 212.5m/s) multiplied by time (86.62097885s) = 18,406.958 meters.
Shot at an angle to optimize distance (45 degrees) you have two components: horizontal velocity (used to calculate distance traveled) and vertical velocity (used to calculate time to drop). They will be the same.
These form a triangle where the hypotenuse is 425m/s. Remember the Pythagorean theorem: A^2 + B^2 = C^2. And also that in a 90-degree triangle (where the angle we care about is 45 degrees), the base and height are equal.
C = 425 m/s
C^2 = 180,625
A^2 = 1/2 * 180,625 (A = B, A^2 = B^2)
A^2 = 90,312.5
A = Sqrt (90,312.5)
A = 300.520382 m/s
B = A
Now we know how fast it is going up (to cacluate time in air) and how fast it is going forward (to calculate how far it goes)
Same calculation as before, different numbers:
Time in air = 2t
t = v/g
t = (300.520382m/s) / (9.812865328m/(s^2))
t = 30.62514077s
2t = 61.25028154s
Now, total (horizontal) distance traveled = t * average velocity (300.520382m/s)
Total Distance traveled = 18,406.958m
The exact same distance.
If you want to compare VERTICAL distance shot up and HORIZONTAL distance shot at 45 degrees, they’re the same.
If you want to compare VERTICAL distance shot up and VERTICAL distance shot at 45 degrees, the one shot upwards goes further.
If you want to compare TOTAL distance traveled, the one shot in an arc (45 degrees) travels further.
Now, even though the bullet is in the air for a shorter period of time (61 vs. 86 seconds) it is traveling (in the direction we care about) at a faster average speed (300 vs. 212 m/s). That is why the numbers come out the same.
Now, if you want an answer if you INCLUDE wind resistance, my guess is that the 45-degree shot will travel a shorter distance since it is in the air longer and therefore wind resistance will have a greater accumulated effect. Never learned that, though ;).