Can you explain me step-by-step manner how you arrived at the given approach to solve this problem

I arrived at the equation given in the image.
But wasn’t able to move forward from this.
Please explain in a step-by-step “evoluionary” manner that how can I arrive at the solution starting from the equation given by me