令y=π/2,得f(x+π/2)+f(x-π/2)=2f(x)cosπ/2=0,
所以f(x+π/2)=-f(x-π/2)=f(π/2-x)
令x=π/2,得f(π/2+y)+f(π/2-y)=2f(π/2)cosy=2cosy,
f(π/2+y)+f(y+π/2)=2cosy
所以f(y+π/2)=cosy,
再令y+π/2=x,
得f(x)=sinx
令y=π/2,得f(x+π/2)+f(x-π/2)=2f(x)cosπ/2=0,
所以f(x+π/2)=-f(x-π/2)=f(π/2-x)
令x=π/2,得f(π/2+y)+f(π/2-y)=2f(π/2)cosy=2cosy,
f(π/2+y)+f(y+π/2)=2cosy
所以f(y+π/2)=cosy,
再令y+π/2=x,
得f(x)=sinx