Put-call parity follows from comparing two portfolios with identical payoff ST−K at expiry: a long call plus short put, versus a long forward (stock financed by borrowing Ke−rT). No-arbitrage forces equal prices today:
C−P=S0−Ke−rT.
Given any three of C,P,S0,K,r,T (with r continuously compounded; replace e−rT by a discount factor Z=1/(1+r)T if compounding is discrete), solve for the fourth. If market prices violate the identity, the cheap side (synthetic or real forward) is bought and the rich side sold: e.g. if C−P>S0−Ke−rT, sell the call, buy the put, buy the stock, borrow Ke−rT — locking a riskless profit equal to the mispricing, realized at T regardless of ST.