Concentric blue wavefronts radiate from the sonar transducer; orange wavefronts are the echo returning from the submarine target. Top edge is the sea surface, bottom edge the seabed.
$$SL - 2\,TL + TS - (NL - DI) \geq DT,\qquad TL = 20\log_{10}R + \frac{\alpha\,R}{1000}$$
Active sonar equation (round-trip). SL = source level, TL = transmission loss (spherical spreading + absorption), TS = target strength, NL = noise, DI = directivity index, DT = detection threshold. R in m, α in dB/km.
$$SL - TL - (NL - DI) \geq DT$$
Passive sonar equation (one-way, no TS). Listens directly to noise radiated by the target.
$$\alpha \approx 0.106\,\frac{f^{2}}{f^{2}+1} + 0.52\,\frac{f^{2}}{f^{2}+4100} + 4.9\!\times\!10^{-4}\,f^{2}\;[\text{dB/km}]$$
Absorption α (simplified Francois-Garrison, f in kHz): boric-acid relaxation, magnesium-sulphate relaxation, pure-water viscosity.
$$c \approx 1449.2 + 4.6\,T - 0.055\,T^{2} + 0.016\,D\;[\text{m/s}]$$
Sound speed (UNESCO simplified, salinity 35‰). T in °C, D in m.