# How do I normalize my Fourier series given Fourier coefficients?

I have an optimization problem in which the Fourier series coefficients optimal value should be found (the optimal signal pattern so to say).

So when I have all the coefficients, I can calculate the signal but the amplitude is then not normalized and I don't know what do I divide the signal by to have it normalized based on the given coefficients.

For example, if I define my Fourier signal as the following, the signal would look like the below graph:

w0 = 2
k0 = 0.02

a0  = 0
a = np.array([1, 1  ])
b = np.array([0, 0  ])

N_sum = a.shape[0]
N = np.arange(1, N_sum+1, 1)

I = a0/2 + np.sum(a*np.cos(N*(w0*t + k0*Z))
+ b*np.sin(N*(w0*t + k0*Z)), axis=1)

plt.plot(Z,I)
plt.scatter(Z[100:700], np.cos(1*w0*t + 1*k0*Z[100:700])+ np.cos(2*w0*t + 2*k0*Z[100:700] ), s=20, color='g')


And the normalization constant would be 2 which I wouldn't know unless I calculate it on many samples.

Or if my signal is defined with different coefficients the normalizing constant would be approx 1.76:

w0 = 2
k0 = 0.02

a0  = 0
a = np.array([1, 0  ])
b = np.array([0, 1  ])

N_sum = a.shape[0]
N = np.arange(1, N_sum+1, 1)

I = a0/2 + np.sum(a*np.cos(N*(w0*t + k0*Z))
+ b*np.sin(N*(w0*t + k0*Z)), axis=1)

plt.plot(Z,I)
plt.scatter(Z[100:700], np.cos(1*w0*t + 1*k0*Z[100:700])+ np.sin(2*w0*t + 2*k0*Z[100:700] ), s=20, color='g')


But all I have available to calculate the normalization constant is the coefficients a, b, a0, k0, and w0, that my optimization will recommend to me.

When normalizing a vector, you divide by its length to produce a new vector of unit length pointing in the same direction: $$u \mapsto \frac{u}{\|u\|}$$ So in this case, you need to divide your signal by its $$\ell^2$$ length, which is the square root of the sum of the squares of its coefficients: $$I \mapsto \frac{I}{\sqrt{\frac{a_0^2}{4} + \sum_k (a_k^2 + b_k^2) }}$$