I think your question is I want to understand the math behind all of this: I would start by doing Andrew Ng's courses on ml and DL at Coursera
Math is wide for AI and moves into multiple disciplines such as calculus, linear algebra.
Once you have done the above courses you can dive accordingly http://sgsa.berkeley.edu/current_students/books/