The MOSFET circuit implements the function.
The op-amp and the 1 mA current source in the circuit of figure are ideal. The output of the op-amp is:
When the switch $S_2$ is closed, the gain of the programmable gain amplifier shown in the following figure is: