Isn't it the job of the air traffic controller to assign altitudes and make sure airplanes do not collide in mid-air? Is having TCAS mandated or optional? If it is a mandate, then is there a mechanism to notify other airplanes that TCAS is off?
TCAS is part of a defense in depth strategy to reduce air accidents. ATC does not cover all areas, so TCAS adds protection where ATC coverage is missing. ATC is not infallible: humans can make errors and computers can go down. With TCAS pilots can get life-saving warnings even in zero visibility, without reliance on any ground based system.
It is the job of the ATC to assign the aircraft altitudes and ensure their safety. But consider the following situations:
There is no ATC coverage.
(one of the) The aicraft fails to respond to the ATC directions.
The aircraft follows the ATC directions, but there is an error either in the aircraft systems/pilot actions or in the ATC directions.
In these situations, the TCAs acts as the next layer of defence against mid-air collisions, acting independently of the ATC.
Most of the regulatory authorities (FAA, EASA etc) mandate TCAS (usually TCAS II) in the civil aircraft beyond a certain capacity, though the requirements vary from country to country.
TCAS is used as a last line of defense to avoid a collision. An air traffic may be distracted or occupied elsewhere and so no instruction is given to the two aircraft. The TCAS overrules any instruction given by air traffic control and the pilots must specific that they are following TCAS over the radio. For example if an aircraft is instructed to descend by air traffic control and TCAS is requesting the aircraft to climb the aircraft will begin a climb. TCAS will order one aircraft to climb and the other aircraft to descend to safely end the conflict between the two aircraft.