Step 1: Choose a substitution-free route:
Use the half-angle formula $2\sin^2\frac{x}{2}=1-\cos x$. This turns the squared sine into a sum of simple terms.
Step 2: Integrate term by term:
\[ \int\sin^2\frac{x}{2}\,dx=\int\frac{1}{2}\,dx-\int\frac{\cos x}{2}\,dx \]
\[ =\frac{x}{2}-\frac{\sin x}{2}+k \]
Step 3: Differentiate every option to check:
We need an option whose derivative is $\sin^2\frac{x}{2}=\frac{1-\cos x}{2}$.
(A) $\frac{1}{2}x-\frac{1}{2}\sin x$ has derivative $\frac{1}{2}-\frac{1}{2}\cos x=\frac{1-\cos x}{2}$. Yes.
(B) $\frac{1}{2}x-\frac{1}{2}\cos x$ has derivative $\frac{1}{2}+\frac{1}{2}\sin x$. No.
(C) $\frac{1}{2}\sin x$ has derivative $\frac{1}{2}\cos x$. No.
(D) $-\frac{1}{2}\sin x$ has derivative $-\frac{1}{2}\cos x$. No.
Final Answer:
Only option (A) differentiates back to $\sin^2\frac{x}{2}$, so the integral is $\frac{x}{2}-\frac{\sin x}{2}+k$.
\[ \boxed{\frac{1}{2}x-\frac{1}{2}\sin x+k} \]