Can any tell the formula for A<B and A=B

I understand the solution but I didn’t found any formula on net. Any valid links are welcome.

in general derivation like :-