(1)f(x)=1-2a-2acosx-2sinx^2=2cosx^2-2acosx-(2a+1)=2(cosx-a/2)^2-(a^2/2+2a+1)
∴g(a)=-a^2/2-2a-1
(2)当g(a)=1/2时
-a^2/2-2a-1=1/2
(a+1)(a+3)=0
解得:a=-1或a=-3.
当a=-1时:f(x)=2(cosx+1/2)^2+1/2
fmax=2(1+1/2)^2+1/2=5
当a=-3时:f(x)=2(cosx+3/2)^2+1/2
fmax=2(1+3/2)^2+1/2=13