Math is obviously based on logic in a heirarchical sense, but what about the historical sense? Is there any historical evidence of a "transition" from first order logic to mathematics? All the examples seem to go the other way, i.e., showing how mathematical axioms already in use can be grounded in formal logic, which gives the impression that formal logic could have been invented to explain why/how math works.
Historically, mathematics and logic evolved independently, though mathematicians have always used forms of logical inference. Euclid, for example, proved things by reductio ad contradictionem which is a kind of rule still used in modern logic. But the two main systems of ancient logic: Aristotle's syllogistic logic and stoic logic, were not mathematical in nature.
These two logics are too weak to express mathematical reasoning. Because of that, Kant held the view that much of mathematics, including arithmetic, is synthetic. Kant's particular take on the distinction between analytic and synthetic is not used today, but roughly we can understand him as meaning that mathematical statements cannot be understood as true by virtue of some kind of conceptual containment relationship.
So logic and mathematics continued to develop independently until the latter part of the 19th century, when there was a crisis in the epistemology of mathematics. Some mathematicians discovered non-Euclidean geometries, and Russell discoverd his eponymous paradox in naive set theory. This was a shock, because mathematics had always been assumed to be concerned with propositions that are necessarily true and indubitably knowable. If we can't trust mathematics, what can we trust?
At the time, Frege had just invented a new logic, which was immensely more powerful and expressive than previous logics. It was essentially what we would now call second order logic. It held the promise of being able to express most, perhaps all, of mathematics and fundamental science. This prompted Russell to pursue the program called logicism, which was the attempt to reduce mathematics to logic. In effect, to show that mathematics is just a highly specialised branch of logic, and it derives its epistemological justification by being grounded in logic. This was what the Principia Mathematica was about.
Logicism as a program is widely regarded as having failed, though there are some neo-logicists who defend a weaker version of it. But even without the aim of a full-blooded reduction of mathematics to logic, it is still highly useful to study the foundations of mathematics using logic. So today there is a two-way interaction between mathematics and logic. We can use mathematical methods to study logic and prove things about systems of logic, such as soundness and completeness. And we can use logic to help set out mathematics in an axiomatic way.
While Bumble's answer is authoritative, I'd like to reason from what we know about the relationship of mathematics and logic to the human brain and language. The human brain, of course is at least the primary seat of thought, though it draws from the body more widely ultimately, and the brain can be construed as a biological computer with a substratum of neurological activity guided by electricochemical gradients. Those neurons themselves embody classical and fuzzy logical processing in the way they are excited and discharge. Logic emerges from the tissues itself at the most fundamental level.
One of the products of the functioning of the human brain is the use of the language centers which generate grammars, which are systems of generating and decoding patterns of sound for the serialization used in communication. Like artificial grammars, inherent to natural grammars is logical consequence. Whereas an artificial grammar, such as a context free grammar, can be constrained to certain formalisms of consequence such as the material conditional and biconditional, the natural grammars are far more complex and nuanced in their use and expression of consequence. While a formal description and language about mathematics emerged before one about logic, reasoning itself exisited a long time before mathematics as a systematic approach to knowledge, something that began with the Mesopotamians and advanced through Euclid evolving into algebraic geometry in Europe. Today's mathematical theories are extremely sophisticated with topics like differential geometry building upon earlier theories, but they all began as distinct ontological domains subjected to reason.
All mathematics of any import has logical consequence built into its methods. But logical consequence itself was formalized independently of mathematicians as a general rule because mathematical systems were useful in commerce and management long before formal logical systems had much utility. In other words, it was far more important to count heads of people and cattle, and to measure materials and land then it was to come up with a formalism to describe logical consequence and connectives. Plus, it is observable that logical consequence and connectives are built into grammars themselves, and the construction of grammars happened long before mathematical systems.
A modern thinker might be excused for not knowing there was a time before there were number systems. In some cultures, mathematics is still confined to shapes, subitization, and pairing. There are languages where there are words for none, one, and many, and nothing more, and equivalence is determined by paring two groups and determining if there is an unassigned residue. Even in English, remnants of that system remain in words like eleven (one left) and twelve (two left). In a hunter gather society, reasoning with people is far more important than counting, calculating, and operating on large quantities. That sort of skill only became useful when agricultural society and city states began to appear.
So, if one looks to an analysis of natural language, one can see clearly that complex mathematical language arose long after the logic that is built into natural language which emerged before written history. Words like 'not', 'or', and 'and' are far older than words like 'add', 'subtract', 'divide', 'multiply', and 'measure'. And the reason for this is that language evolved to help people survive, and logical consequence is far more important than mathematical conclusions based on logical consequence, a fact made evident in language acquisition when a child quickly masters logical consequence without formal instruction, but requires extensive education in learning number systems and performing operations on them. As every elementary school teacher knows, all students are born lawyers, but not all of them are born mathematicians.
Definitions provide the answer. This couple of definitions, useful for philosophy, are my synthesis, based on the work of others.
To start, there's no "formal logic" or "informal logic".
Logic is the formal expression of the rules of reason.
The "informal" side of Logic is just reason. Notice that there's no such distinction in mathematics. Mathematics is the same term for the tooling aspect and for the communicational (language) aspect.
Second, the definition of mathematics requires a bit of context.
Synthesizing Kant's epistemological proposition, we start a priori (which does not mean "previously", but moreover "necessarily") with the development of the contexts where things (the object) will exist (space and time, cf. Transcendental Aesthetic), and there's where reason starts to develop, so, you can say that reason (the tool) or logic (the language) emerge, previous to mathematics.
Then, the object emerges, as a concept, which I associate mostly with the database which is knowledge, or as the object, which would be the dynamic entity that represents the atomic element of reason (cf. Transcendental Logic). So, reason develops rules about how such abstractions (the object) interact between them: voilà, the emergence of mathematics. This answers your question, while providing the definition:
Mathematics is the set of rules that describe the rational interactions between abstract objects.
So, strictly from a chronological perspective, logic and mathematics develop simultaneously. But from a systemic perspective (which system is necessary/is the base for the other to be possible), reason (the tool) /or logic (the language) is a priori to mathematics (the tool and the language).
Mathematics is all-encompassimg per a specific definition, that math is the study of patterns. One could argue-reply that math is about arithmetico-geometric-etc. properties of patterns. From my dabblings I sense logic has been to some degree mathematized (Venn Diagrams for example). What is logic but the study of patterns of correct thinking (argument forms). I guess what I'm trying to say is logic is a subset of math, viewed thus.
And yet, we could make the case that math is the application of logic to, sensu latissimo, numbers (arithmetic) & shapes (geometry).
Can we logicize math? Can we mathematize logic? Are they the same/not/both/neither?