I am being really thick here

I have this wave equation, the massless klien gordon equation

where the summation over is over 0,1,2,3

the general solution is a superposition of plane waves yes? i.e

where is the weighting function.

When you susbsitute this back into the klein gordon equation you get down two factors of p, i.e

which equals zero. (mass shell constraint)

My question is, is arbitrary? I don't really understand why this is so, let alone believe it.

Hope peeps understand the question.