Through my research I faced to the following equality and need to find $c_i^{t+1}$. Moreover, I found that it can be solved by Crank–Nicolson method (see here here: https://en.wikipedia.org/wiki/Crank%E2%80%93Nicolson_method). Unfortunately I could not understand how to use the method and I did not calculate the solutions. Any one can help me to calculate the solutions? Thanks in advance. \begin{align*} \frac{c_{i}^{t+1}-c_{i}^{t}}{\Delta t}&=\frac{D}{2}(\frac{c_{i+1}^{t}-2c_{i}^{t}+c_{i-1}^{t}}{{\Delta x}^{2}}+ \frac{c_{i+1}^{t+1}-2c_{i}^{t+1}+c_{i-1}^{t+1}}{{\Delta x}^{2}} ) \\&-\frac{V}{2}(\frac{c_{{\color{red}i} {\color{red}+}{\color{red}1}}^{t}-c_{i-1}^{t}}{2\Delta x}+ \frac{c_{i+1}^{t+1}-c_{i-1}^{t+1}}{2\Delta x} ) \end{align*}
My working on this problem:
The Crank–Nicolson method \begin{align}\label{1} \frac{\partial C}{\partial t} = D_x \frac{\partial^2 C}{\partial x^2} - U_x \frac{\partial C}{\partial x} \,(1) \end{align}
We know that: \begin{align}\label{2} \frac{\partial C}{\partial t} \Rightarrow \frac{C_i^{t+1} - C_i^t}{\Delta t},\,(2) \end{align}
\begin{align}\label{3} \frac{\partial^2 C}{\partial x^2} \Rightarrow \frac{1}{2 (\Delta x)^2}\left( (C_{i+1}^{t+1} - 2 C_i^{t+1} + C_{i-1}^{t+1}) + (C_{i+1}^t - 2 C_i^t + C_{i-1}^t) \right),\,(3) \end{align}
\begin{align}\label{4} \frac{\partial C}{\partial x} \Rightarrow \frac{1}{2}\left( \frac{(C_{i+1}^{t+1} - C_{i-1}^{t+1})}{2 (\Delta x)} + \frac{(C_{i+1}^t - C_{i-1}^t)}{2 (\Delta x)} \right),\,(4) \end{align} Now putting (2), (3), (4) in (1) and $D_x=D$ ,$U_x=V$ we get \begin{align*}\label{5} \frac{c_{i}^{t+1}-c_{i}^{t}}{\Delta t}&=\frac{D}{2}(\frac{c_{i+1}^{t}-2c_{i}^{t}+c_{i-1}^{t}}{{\Delta x}^{2}}+ \frac{c_{i+1}^{t+1}-2c_{i}^{t+1}+c_{i-1}^{t+1}}{{\Delta x}^{2}} ) \\&-\frac{V}{2}(\frac{c_{i+1}^{t}-c_{i-1}^{t}}{2\Delta x}+ \frac{c_{i+1}^{t+1}-c_{i-1}^{t+1}}{2\Delta x} ) \end{align*}
So it is obtained \begin{align} \frac{c_{i}^{t+1}-c_{i}^{t}}{\Delta t}&=\frac{D}{2{\Delta x}^{2}}({c_{i+1}^{t}-2c_{i}^{t}+c_{i-1}^{t}}{}+ {c_{i+1}^{t+1}-2c_{i}^{t+1}+c_{i-1}^{t+1}}{} ) -\frac{V}{4\Delta x}({c_{i+1}^{t}-c_{i-1}^{t}}{}+ {c_{i+1}^{t+1}-c_{i-1}^{t+1}} ) \end{align} $$\Rightarrow$$ \begin{align*} c_{i}^{t+1}=c_{i}^{t}+\frac{D\Delta t}{2{\Delta x}^{2}}({c_{i+1}^{t}-2c_{i}^{t}+c_{i-1}^{t}}{}+ {c_{i+1}^{t+1}-2c_{i}^{t+1}+c_{i-1}^{t+1}}{} ) -\frac{V\Delta t}{4\Delta x}({c_{i+1}^{t}-c_{i-1}^{t}}{}+ {c_{i+1}^{t+1}-c_{i-1}^{t+1}} ) \end{align*}
Now putting $\lambda = \frac{D \Delta t}{2 \Delta x^2}$ and $\sigma = \frac{V \Delta t}{4 \Delta x}$ we have;
\begin{align*} c_{i}^{t+1}=c_{i}^{t}+\lambda({c_{i+1}^{t}-2c_{i}^{t}+c_{i-1}^{t}}{}+ {c_{i+1}^{t+1}-2c_{i}^{t+1}+c_{i-1}^{t+1}} ) -{\sigma}({c_{i+1}^{t}-c_{i-1}^{t}}+ {c_{i+1}^{t+1}-c_{i-1}^{t+1}} ) \end{align*} $$\Rightarrow$$ \begin{align*} (1+2\lambda)c_{i}^{t+1}=(1-2\lambda)c_{i}^{t}+(\lambda-\sigma)c_{i+1}^{t}+(\lambda+\sigma)c_{i-1}^{t}+(\lambda-\sigma)c_{i+1}^{t+1}+(\lambda+\sigma)c_{i-1}^{t+1} \end{align*} $$\Rightarrow$$
\begin{align*} c_{i}^{t+1}=\frac{1}{(1+2\lambda)}\big((1-2\lambda)c_{i}^{t}+(\lambda-\sigma)c_{i+1}^{t}+(\lambda+\sigma)c_{i-1}^{t}+(\lambda-\sigma)c_{i+1}^{t+1}+(\lambda+\sigma)c_{i-1}^{t+1}\big) \end{align*}
Now I do not know coefficient matrixes cited here (https://en.wikipedia.org/wiki/Crank%E2%80%93Nicolson_method) how make and how the closed form for $c_{i}^{t+1}$ is obtained?