Submarines travel deep under the sea, but they still need to know where they are. Near the surface they can use a GPS antenna, but once they go a few centimeters below the water, the signal disappears. So they need other ways to find their position.
One simple method is to listen with sonar. The sub sends a quiet sound pulse down, and the echo tells it how far the seafloor is. By comparing these echoes to old maps, the crew can guess their location. To know which way the boat is pointing, submarines use a gyroscope made of fiber optic cable. Light travels around the coil in two directions; when the sub turns, the light paths change a tiny bit, creating a shift in phase. That shift tells the computer the rotation. To measure how far the sub has moved, an accelerometer is used. A small weight sits on a thin quartz beam that vibrates at a steady frequency. When the boat speeds up, the weight pulls the beam, changing the pitch, and the computer reads the change.
By combining the turn information from the gyroscope and the distance from the accelerometer, the submarine can draw its trajectory without ever surfacing. This quiet, internal system lets the crew stay hidden while still knowing exactly where they are.