YTM is the yield that equates bond value to price by discounting all future cash flows.
highlighted = computed this step
Solve for YTM
Yield to maturity is the discount rate that makes discounted contract value equal the observed price. At par, this worked bond has price $1,000.00 and yield 10%.
P=t=1∑n(1+YTM)tCt
Off-par price
Instead of pretending to algebraically invert price to yield, choose an off-par yield of 12.5% and price the same cash flows exactly. The result is rounded $940.47, exact 685600/729 dollars.
y=12.5%⇒P≈$940.47
Substitution check
Substituting that same yield gives exact dollar terms 800/9, 6400/81, and 563200/729. They sum to 685600/729 dollars, the exact constructed price.
That substitution check confirms the chosen rate prices the observed off-par bond. In general, solving price to yield is a numerical root-finding problem; here we demonstrate YTM by construction, not by claiming a closed-form inverse.