Mathematics is really about proving general statements via arguments, usually called proofs. As you no doubt know from arguing with friends, not all arguments are good arguments. A “bad” argument is one in which the conclusion does not follow from the premises, i.e., the conclusion is not a consequence of the premises. Logic is the study of what makes an argument good or bad. Mathematical logic is the subfield of philosophical logic devoted to logical systems that have been sufficiently formalized for mathematical study.
Thumbnail: P. Oxy. 29, one of the oldest surviving fragments of Euclid's Elements, a textbook used for millennia to teach proof-writing techniques. The diagram accompanies Book II, Proposition 5. (Public Domain). Text from Oscar Levin's Discrete Mathematics text (CC BY-SA).