Given: A and B acts as the Two inputs of the circuit Y is the output.
a)
Let left side of the output is given as,
The output of the left of the NAND gate is given as,
This output is fed through the another NAND Gate.
The circuit output is given as,
Substitute the value of
Thus, the circuit acts as AND Gate.
b)
The output of the circuit is given as,
Thus, the circuit acts as OR gate.