This concept is explained concisely by IITian Faculty.
Any Time Padhai Academy
(ATP Academy provides awesome content for students Preparing for IIT JEE & NEET).
It is founded by IIT graduate Vineet Khatri which is famous name among thousands of students all over India. Thousands of IITians have been made under his mentorship.
Like ATP Academy on Facebook
https://web.facebook.com/Any-Time-Padhai-Academy-1034624919960861/
& Follow Vineet Khatri on Facebook
https://web.facebook.com/vineetkhatrivk/?fref=ts
source
Sir, x1cos(theta) = x2 now if differentiate it then it would lead to that complex relation. It is because here we are not assuming theta constant. When we write a1cos(theta) = a2 then it is valid only at a particular angle theta. It is not a general relation between accelerations of two blocks..... Right ?