Output of the first intermediate NAND gate=A⋅B
Upper path intermediate NAND gate output=Y1=A⋅A⋅B
Lower path intermediate NAND gate output=Y2=B⋅A⋅B
Y=Y1⋅Y2=A⋅A⋅B⋅B⋅A⋅B
Y=(A⋅A⋅B)+(B⋅A⋅B)
Y=(A+B)⋅A⋅B
Y=(A+B)⋅(Aˉ+Bˉ)
Y=AAˉ+ABˉ+BAˉ+BBˉ
Y=ABˉ+AˉB=A⊕B(XOR operation)