A projectile launched from O must pass through P at horizontal distance 5 m and height 1 m. The trajectory equation fixes the required speed for each launch angle and also tells whether the highest point comes before or after P.
The projectile equation gives the speed needed for any allowed launch angle.
With tan45° = 1 and cos²45° = 1/2, the speed is fixed as stated.
For θ = 45°, the apex lies at x = v²sinθcosθ/g = 25/8 m, which is less than 5 m.