Should I do exercises given in online course and accompanying textbook if I want to do research in machine learning ahead? I'm a junior year computer science undergrad just began to study machine learning a month ago. My aim is to start reading papers in my area of interest under Machine Learning and begin to do research in ML as an intern/independent project. I want to further go to grad school after a gap year and earn an MS + Ph.D. in machine learning.

I'm taking Prof. Andrew Ng's CS229 lectures online and side by side reading relevant chapters from Bishop's "Pattern Recognition and Machine Learning" book.

The mathematical problems/exercises given in both the problem sets of CS229 and PRML textbook are mathematically too sophisticated for me to solve on my own, although I can follow the solutions. How much of these exercises would an undergrad/masters student be expected to solve? And if I am considering a Ph.D., should I solve them or skip them at all?

Will only the mathematical knowledge and implementation of machine learning algorithms matter to start with research and later in grad school without spending time on these exercises?
Actually, most people require practice and reinforcement to learn much of anything. Reading and seeing isn't enough to get more that a superficial "acquaintance" with anything. Especially any thing complex. 

So, yes, you should do the exercises. Following along with the given solutions isn't the same as actually doing them. 

But, success won't come immediately, nor easily, if the topic is deep. You can also look for simpler exercises in a field if the ones you have elude you. But practice is essential for nearly everyone. The exceptions are very rare. 

Also, you need some feedback on your solutions and this is very difficult to get in a purely online course. Look for local resources to find someone who can look at the work you do and comment on it. It is possible to develop bad habits if you don't get suitable feedback. Eventually you may be able to work through those habits to better ones, but the path will be longer.