Can we simplify the following fraction as :-

and then further simplification....

A friend of mine was contradicting this approach and was saying that if the denominator contains variables then you simply can't do it like this. His solution however was that :-

the solution would be that :-

Either, or

What is the real solution ?