In the 1970s, U.S. President Richard Nixon instructed Secretary of State Henry Kissinger to convince the leaders of hostile communist countries that he could be erratic and volatile, particularly when under pressure. Kissinger, a shrewd practitioner of realpolitik, saw the potential in this approach, which he readily implemented. With that, the "madman theory" of diplomacy was born.
Nixon was far from mad, though his heavy drinking at the height of the Watergate scandal prompted Kissinger and Secretary of Defense James Schlesinger to establish a way to monitor his control of the nuclear codes. Nixon's goal in trumpeting his supposed erratic nature was to stoke fear among his foreign adversaries that making him angry or stressed could result in an irrational — even nuclear — response, thereby impelling them to check their own behavior.
Today, with Donald Trump leading the United States, the madman doctrine is back with a vengeance. But, this time around, it is far less clear that it's just an act, and that Trump would not really decide, in a fit of rage or frustration, to attack, or even nuke, his opponents.