How did anti-submarine warfare work?

by 1122334411

Was watching Das Boot last night and I realized I've never understood how depth charges are used. I know they use planes and such but how can they locate the position of a sub if it's gone silent?

BreaksFull

By actively pinging it with sonar like a dolphin to determine their approximate location. Sound waves go through the water, bounce off the U-Boat, and return to the sonar operator who uses that to determine the location of the sub. Then they sail over the location and depth charge/hedgehog the shit out of the location, hoping to sink the sub.