4 Given $M=\{x \mid 1 \leqslant x \leqslant a, a>1\}$, if the domain and range of the function $y=\frac{1}{2} x^{2}-x+\frac{3}{2}$ are both the set $M$, then $a=$ $\qquad$ .
4 3. $y=\frac{1}{2}(x-1)^{2}+1$, from this we know that when $x \geqslant 1$, $y \geqslant 1$, and it is an increasing function. When $x=a$, $y=a$, so $a=\frac{1}{2}(a-1)^{2}+1$, and $a^{2}-4 a+3=0$. Solving this, we get $a=3, a=-1$ (discard).