RK4 is:
$$\begin{aligned}k_1&=hf(x_n, y_n)\\ k_2&=hf(x_n+h/2. y_n+k_1/2)\\ k_3&=hf(x_n+h/2, y_n+k_2/2)\\ k_4&=hf(x_n+h, y_n+k_3)\\ y_{n+1}&=y_n+(k_1+2k_2+2k_3+k_4)/6\end{aligned}$$
I want to know the reason of the coefficients $1/2, 1/6, 1/3$.
Is this the solution to some optimization problem? What is the general rule?