Logic (from Classical Greek λόγος logos; meaning 'speech/word') is the study of the principles and criteria of valid inference and demonstration. The term "logos" was also believed by the Greeks to be the universal power by which all reality was sustained and made coherent and consistent.
As a formal science, logic investigates and classifies the structure of statements and arguments, both through the study of formal systems of inference and through the study of arguments in natural language. The field of logic ranges from core topics such as the study of fallacies and paradoxes, to specialized analysis of reasoning using probability and to arguments involving causality. Logic is also commonly used today in argumentation theory. 
Traditionally, logic is studied as a branch of philosophy, one part of the classical trivium, which consisted of grammar, logic, and rhetoric. Since the mid-nineteenth century formal logic has been studied in the context of the foundations of mathematics. In 1903 Bertrand Russell and Alfred North Whitehead attempted to establish logic as the cornerstone of mathematics formally with the publication of Principia Mathematica. However, the system of Principia is no longer much used, having been largely supplanted by set theory. The development of formal logic and its implementation in computing machinery is the foundation of computer science.