If math refers to the real patterns and relations built into reality, then it was discovered. If it refers to the symbols, notation, and systems of thought used to describe those patterns, then it was invented. In TST terms, the structure belongs to the Material World, while mathematics as a formal language belongs to the realm of Ideas.