Can someone point me out to in depth video / material to understand the math behind the same.

Hello Vaibhav.

Please look at the links below to get a proper understanding.

- How Logistic Regression Works? (How logistic regression works)

& next on how the transposition is done:

In addition to @Rashmsi’s suggestions, and from the broadest perspective, the foundational material is the undergraduate “canon” of introductory calculus and linear algebra. That could be extended to include a course in probability and statistics. Obviously, quite the commitment. Coursera offers a specialization through the University College of London geared toward machine learning. That would certainly be a more expeditious route to developing this foundation. There are undoubtedly others; I got this from a (very) quick Google search.