First as already mentioned in the other answer the second formula for yield to maturity (YTM) works only for zero coupon bond.
For a non-zero coupon bond YTM would be given by solving the first formula for YTM (r). However, unfortunately this has to be done numerically as there is no simple formula to do it analytically see discussion in Berk et al Fundamentals of Corporate finance 197.
So, how can we calculate the market value of a bond if we need to know YTM, but YTM is itself dependent on the market value of the bond?
I know information about the bond's coupon rate, face value, coupon frequency, and time until the maturity date.
Without having data on market value of bond that is impossible. Just knowing coupon rate, face value, coupon frequency, and time until the maturity date is insufficient information to calculate YTM.