# How to find the coefficient of heat equation solution with non-odd initial condition

I've got a situation where I'm supposed to solve the 1-D heat equation $$v_t = c^2 u_{xx}$$ under boundary conditions and an initial condition, and so after some run-of-the-mill process, I attained the general solution $$v(x,t) = \sum_{n = 1}^{\infty} A_n\sin(n\pi x)e^{-\lambda_n^2 t}$$ where $$\lambda_n = cn\pi$$ and $$n \in \mathbb{N}$$.

However, I was given an initial condition of $$v(x, 0) = f(x) = -(1 + x)$$ with $$0 < x < 1$$, of which I understand is neither an odd or an even function. Thus, I'm not entirely sure that using Fourier series will be able to lead me to find values for $$A_n$$, and if it was able to be done then could someone explain how? I'm in a bit of a pickle now and so any help is much appreciated!

If you apply the initial condition to your solution you will be able to solve for the coefficient $$A_{n}$$.
$$v(x,0) = f(x) = \sum_{n=1}^{\infty} A_{n} \sin(n \pi x) = -(1+x)$$
$$A_{n} = \int_{0}^{1} f(x) \sin(n \pi x) \textrm{d}x$$
$$A_{n} = - \int_{0}^{1} (1+x) \sin(n \pi x) \textrm{d}x = - \frac{\pi n + \sin(\pi n) - 2\pi \cos( n \pi)}{\pi^{2} n^{2}}$$
• When the function is even or odd you get simpler representations I believe but this method for finding the coefficients works either way. The coefficients go to $0$ as $n \to \infty$ – Shogun May 10 at 17:44