According to Locke, it is impossible to obtain substantive knowledge from analytic propositions. Statements like "triangle has three sides" are analytic, but one cannot derive the Pythagorean Theorem analytically. However, Frege says that mathematical (arithmetical) truths are analytic. This raises a problem that although Locke's thesis about analytic knowledge is very convincing, analytic arithmetic knowledge is possible. How is this possible?
Frege is the founder of a program called logicism that aimed to reduce all of mathematics to logic. In order to reduce mathematics to logic Frege had to expand what is meant by logic. Before him Locke, Kant and others understood by logic only Aristotle's syllogistic, which is a manipulation of simple implications (syllogisms). Frege's Logic went much further, and encompassed all of arithmetic in particular, if not all of set theory. But derivable from logic alone is what all three meant by "analytic". Under logicism all of mathematics would be analytic, including much of what Kant called "synthetic a priori" (but not the parts related to geometry and physics). So both Locke and Frege were right, they just meant different things by "analytic".
"Frege's conception of the analytic was suitably broader than Kant's. Kant required that conceptual containments be evident within the sentence, rather than that the sentence be displayed as a conclusion following logically from axioms whose own logical or conceptual truth was self-evident, and which might contain expressions not occurring in the sentence in question... Kant did not regard ‘7 + 5 = 12’ as an analytic truth. The Fregean, by contrast, is able to exploit the internal structure of the numerals, and to invoke the recursion axioms for addition (which themselves would have to have been derived in logicist fashion). So, for the Fregean, even if not for Kant, ‘7 + 5 = 12’ is an analytic truth."
The best attempt to realize the logicism program was Russell and Whitehead's book Principia Mathematica. However, after Gödel's results on incompleteness the program came to be viewed as a dead end, and was largely abandoned. Later, Quine argued convincingly that the analytic/synthetic distinction itself, even in a revised form adopted by logical positivists, can not be maintained at all. According to Quine, all knowledge, including the laws of logic, is synthetic, and ultimately empirical, this dealt a further blow to logicism. Although it is no longer believed that "all of mathematics" reduces to logic, the modern mathematical logic is much closer to Frege's conception of logic than to Kant's or Locke's.
Frege's thesis was not that mathematics as a whole was analytic, just that arithmetic (the theory of whole numbers) was so. Frege criticized Kant about arithmetic, but he agreed with Kant that geometry was synthetic. As to that Pythagoras' theorem cannot be deduced from the definition of a triangle alone, there is surely no dispute.
We shall do well in general not to overestimate the extent to which arithmetic is akin to geometry . . . For purposes of conceptual thought we can always assume the contrary of some one or other of the geometrical axioms, without involving ourselves in any self-contradictions . . . The fact that this is possible shows that the axioms of geometry are independent of one another and of the primitive laws of logic, and consequently are synthetic. (Frege, The Foundations of Arithmetic §13)