Avichal said:
Oh thanks for telling me about bats and dolphins - read them up on wikipedia.
So I suppose they came up with these abilities because they usually stay in dark. So they don't have light to help them detect thing around them. So they use sound to "see" things.
This is probably true for bats. Bats rest and take care of off spring in the depths of caves. Natural caves are completely dark. Most bats hunt for food at night. The night sky is not completely dark all the time. There is no way a bat can see in a cave.
Bats do use their eyes to see. Bats are not blind. Most of them have good eyes which they use when light is available. The moon provides some light during part of the month. Bats like to hunt at the twilight hours, where some sunlight from below the horizon is scattered by atmospheric particles. However, the sky is dark enough even at that time to cause problem in hunting for animals that depend on sight alone.
I don't think that is strictly true for dolphins. Most dolphins hunt close enough to the surface that sunlight reaches them. They may visit the bottom of the sea, but they don't live there. Furthermore, dolphins are diurnal. They prefer to move during the day. So sight is still useful for most dolphins.
It should be pointed out that all extant toothed whales have sonar. Dolphins are just one type of toothed whale. A dolphin by some definitions is just a small toothed whale of any species.
The most famous type of dolphin, Tursiops truncatus, lives in lots of different environments. Different families of Tursiops truncatus not only live in separate environments, they have a family "culture" that specializes in hunting in these separate environments. So one could probably find a number of uses for sonar just in this one species alone. However, there are a lot of toothed whales who are not Tursiops truncatus. So I wouldn't make a broad statement on why dolphins have sonar.
There are many species of of toothed whales which have differing lifestyles. The reason for using sonar is almost as varied as their life styles. Some toothed whales do hunt at great depths where the sunlight doesn't reach. However, I don't think most of them hunt in the darkest depths of the ocean.
Very few dolphin species are blind. The ones that are blind live in muddy rivers. Mud scatters light, there by scrambling the light-images. I think light gets down there, even through mud, but images are blurry. So sight isn't very useful, even if there is light.
Porpoises live in estuaries and bays. The water in these types of water ways is sometimes muddy and sometimes not muddy. Porpoises have both sonar and sight for obvious reasons.
One reason that oceanic toothed whales may have evolved sonar is because water attenuates light over over large distances. Particles in the water (algae, etc.) scatter light and scramble images. So some toothed whales probably need the sonar to hunt over large distances.
I don't think the sonar of a toothed whale is useful to find things out of water. There is an impedance mismatch between air and water that makes sound bounce off the surface. This reflection moves in both directions. So for a dolphin underwater to image above water, it needs sight. Not sonar.
Narwhals are strange looking dolphins that hunt underneath arctic ice. So they do hunt in darkness much of the time. However, they do get out from under there every summer.
I think that the sonar capability originated in the common ancestors of all toothed whales that live about 30 million years ago. My guess is that the common ancestor of all toothed whales probably hunted near the bottom of the ocean. Whatever the original reason, sonar is used for a lot of different reasons for a lot of difference species. There are many species of toothed whale with many different uses for sonar.