# Differentiation of a series with unknown coefficients

I have a function $$f(x)$$ expressed as $$f(x) = \sum_{k=1}^n {a_k}sin(kx)$$ and its derivative with respect to $$x$$ is then $$f'(x) = \sum_{k=1}^n k{a_k}cos(kx)$$

I am actually new to Mathematica and am not comprehensively familiar with its capabilities. However, I tried to write $$f(x)$$ asf(x_) = Sum[Table[(Subscript[a, k])*Sin[x*k], {k, 3}]which gave me $$f(x)$$, but I do not know how to proceed with differentiation with respect to $$x$$ without defining a new series again for $$f'(x)$$

• f[x_]:=Sum[(Subscript[a, k])*Sin[x*k], {k, 3}], then D[f[x], x]. – Alx Oct 24 at 14:21