{"id":1343,"date":"2025-02-23T09:31:55","date_gmt":"2025-02-23T09:31:55","guid":{"rendered":"https:\/\/www.mathros.net.ua\/en\/?p=1343"},"modified":"2026-07-18T13:06:58","modified_gmt":"2026-07-18T13:06:58","slug":"runge-kutta-method","status":"publish","type":"post","link":"https:\/\/www.mathros.net.ua\/en\/runge-kutta-method.html","title":{"rendered":"Runge-Kutta Method Step by Step: How Does It Calculate an Approximate Solution?"},"content":{"rendered":"<p>Numerical methods are often used to find approximate solutions to <a title=\"Ordinary differential equation\" href=\"https:\/\/en.wikipedia.org\/wiki\/Ordinary_differential_equation\" target=\"_blank\" rel=\"nofollow noopener\">ordinary differential equations (ODEs)<\/a>, especially when an analytical solution is too complicated\u2014or sometimes even impossible\u2014to obtain. One of the most powerful tools in this area is the Runge-Kutta method. It achieves a high level of accuracy without requiring the calculation of higher-order derivatives. But how exactly does it work in practice?<\/p>\n<h2>The Runge-Kutta Method: The Main Idea<\/h2>\n<p>Suppose we want to solve a first-order ordinary differential equation:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-10024050 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method1.jpg\" alt=\"ordinary differential equation\" width=\"65\" height=\"15\" \/><\/p>\n<p>with an initial condition <em>y(x<sub>0<\/sub>)=y<sub>0<\/sub><\/em>. We aim to find the solution on an interval <em>[a, b]<\/em>. We divide this interval into <em>n<\/em> equal parts, where <em>h=(b-a)\/n<\/em>. Then, the points at which we will compute approximate values of <em>y<\/em> are:\u00a0<em>x<sub>i<\/sub>=x<sub>0<\/sub>+i\u22c5h<\/em> (\u0434\u0435 <em>i=1,2,3,&#8230;,n<\/em>; <em>x<sub>0<\/sub>=a<\/em>; <em>x<sub>n<\/sub>=b<\/em>).<\/p>\n<p>The Runge-Kutta method lets us move step by step from <em>y<sub>0<\/sub><\/em> to <em>y<sub>1<\/sub><\/em>, <em>y<sub>2<\/sub><\/em>, and so on. Each step is based on finding the increment <em>\u0394y<sub>i<\/sub><\/em>, which we then use to compute the next approximate value:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-10024052 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method2.jpg\" alt=\"runge-kutta method\" width=\"81\" height=\"13\" \/><\/p>\n<p>But how do we find <em>\u0394y<sub>i<\/sub><\/em>? That\u2019s where the interesting part begins!<\/p>\n<h2>Taylor Expansion and Auxiliary Coefficients: How to Find \u0394y<sub>i<\/sub>?<\/h2>\n<p>To answer this, let\u2019s recall the Taylor expansion of <em>y(x)<\/em> over a small interval of length <em>h<\/em>. If we consider the change in <em>y(x)<\/em> from <em>x<sub>i<\/sub><\/em> to <em>x<sub>i<\/sub>+h<\/em>, we get:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-10024054 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method3.jpg\" alt=\"Taylor expansion\" width=\"397\" height=\"30\" \/><\/p>\n<p>Why not just use this formula directly? While it may sound appealing, in practice, calculating the second, third, or even fourth derivatives can become a real challenge. That\u2019s why the Runge-Kutta method takes a different approach\u2014replacing those <em>&#8220;higher-order derivatives&#8221;<\/em> with several intermediate estimates of the <em>&#8220;regular&#8221;<\/em> first derivative.<\/p>\n<h3>The Increment Formula and the Coefficients k<sub>1<\/sub>, k<sub>2<\/sub>, k<sub>3<\/sub>, k<sub>4<\/sub><\/h3>\n<p>For fourth-order accuracy, we introduce special coefficients <em>k<sub>1<\/sub><\/em>, <em>k<sub>2<\/sub><\/em>, <em>k<sub>3<\/sub><\/em>, <em>k<sub>4<\/sub><\/em>. They help us take into account how the function <em>f(x, y)<\/em> changes inside the step <em>h<\/em>. Let\u2019s take a closer look:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10024057 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method4.jpg\" alt=\"runge-kutta method\" width=\"142\" height=\"87\" \/><\/p>\n<p>Why these particular formulas? The idea is that <em>k<sub>1<\/sub><\/em> approximates the derivative at the start of the step, <em>k<sub>2<\/sub><\/em> and <em>k<sub>3<\/sub><\/em> capture <em>&#8220;what\u2019s happening in the middle&#8221;<\/em>, and <em>k<sub>4<\/sub><\/em> estimates the derivative at the end of the interval. We then combine them using carefully chosen weights:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10024058 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method5.jpg\" alt=\"runge-kutta method\" width=\"175\" height=\"27\" \/><\/p>\n<p>This weighted average is so accurate that it provides fourth-order precision without explicitly calculating higher-order derivatives.<\/p>\n<p>Finally, we substitute <em>\u0394y<sub>i<\/sub><\/em> back into the key formula:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-10024052 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method2.jpg\" alt=\"runge-kutta method\" width=\"81\" height=\"13\" \/><\/p>\n<h2>Advantages: Why Is the Runge-Kutta Method So Effective?<\/h2>\n<ol>\n<li><strong>High Accuracy<\/strong>: Fourth-order means the error decreases much faster compared to the <a title=\"How Euler\u2019s Method Works\" href=\"https:\/\/www.mathros.net.ua\/en\/eulers-method.html\">Euler&#8217;s method<\/a> or even its <a title=\"Modified Euler\u2019s Methods\" href=\"https:\/\/www.mathros.net.ua\/en\/modified-eulers-method.html\">improved variants<\/a>.<\/li>\n<li><strong>No Complex Derivatives<\/strong>: There\u2019s no need to compute second, third, or fourth derivatives. Everything relies on the function <em>f(x, y)<\/em> and the basic first derivative.<\/li>\n<li><strong>Versatility<\/strong>: This method is used in physics, engineering, biology, economics\u2014anywhere you find differential equations.<\/li>\n<\/ol>\n<p>Thanks to these strengths, the Runge-Kutta method is a true game-changer for anyone looking to get precise and efficient solutions to differential equations. It lets you quickly approximate the real behavior of complex systems without struggling with complicated higher-order derivatives. Ready to see it in action?<\/p>\n<h2>Solving Differential Equations with the Runge-Kutta Method: An Example<\/h2>\n<p>We already know the main idea and why it\u2019s so efficient. But what does it look like in practice? Let\u2019s walk through a concrete example to see just how closely the Runge-Kutta method can match the actual solution.<\/p>\n<h6>Example 1: Find an Approximate Solution to the Differential Equation y\u2019=y-x with the Initial Condition y(0)=1.5 Over the Interval [0, 1], Using Both Modifications of Euler\u2019s Method. Additionally, We\u2019ll Compare the Obtained Results With the Exact Solution: y(x)=0.5\u22c5e<sup>x<\/sup>+x+1<\/h6>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10024079 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method13.jpg\" alt=\"runge-kutta method example\" width=\"621\" height=\"350\" \/><\/p>\n<p>To solve this, we choose a step size of <em>h=0.2<\/em> and divide the interval <em>[0, 1]<\/em> into five equal parts: <em>x<sub>0<\/sub>=0<\/em>, <em>x<sub>1<\/sub>=0.2<\/em>, <em>x<sub>2<\/sub>=0.4<\/em>, <em>x<sub>3<\/sub>=0.6<\/em>, <em>x<sub>4<\/sub>=0.8<\/em>, <em>x<sub>5<\/sub>=1<\/em>.<\/p>\n<p>Now, let&#8217;s compute the values step by step.<\/p>\n<ol>\n<li><strong>Calculation for <em>x<sub>1<\/sub><\/em><\/strong>:<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10024066 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method7.jpg\" alt=\"runge-kutta method example\" width=\"430\" height=\"130\" \/><\/p>\n<ol start=\"2\">\n<li><strong>Calculation for <em>x<sub>2<\/sub><\/em><\/strong>:<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10024067 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method8.jpg\" alt=\"runge-kutta method example\" width=\"474\" height=\"130\" \/><\/p>\n<p>Continuing in the same manner for the remaining steps, we get:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10024069 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method9.jpg\" alt=\"runge-kutta method example\" width=\"220\" height=\"13\" \/><\/p>\n<p>Now, let\u2019s compute the exact solution <em>y(x)=0.5\u22c5e<sup>x<\/sup>+x+1<\/em> at the same points:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10024072 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method11.jpg\" alt=\"runge-kutta method example\" width=\"311\" height=\"75\" \/><\/p>\n<p>As you can see, the values found using the Runge-Kutta method are almost identical to the exact solution. The error is minimal, which underscores the advantages of this method. Unlike the Euler method, where errors accumulate more significantly with each step, the fourth-order Runge-Kutta method maintains impressive accuracy throughout.<\/p>\n<h2>Other Numerical Methods: What Else is Worth Exploring?<\/h2>\n<p>The Runge-Kutta method is an excellent way to find approximate solutions to differential equations, but it\u2019s not the only option. If you want to expand your toolkit, consider looking into:<\/p>\n<ol>\n<li><a title=\"Runge-Kutta-Merson Method\" href=\"https:\/\/www.mathros.net.ua\/en\/runge-kutta-merson-method.html\">Runge-Kutta-Merson Method<\/a> &#8211; A modification of the classic Runge-Kutta method with an adaptive step size that automatically adjusts to a specified error tolerance.<\/li>\n<li><a title=\"Adams Method\" href=\"https:\/\/www.mathros.net.ua\/en\/adams-method.html\">Adams Method<\/a> &#8211; A &#8220;predictor-corrector&#8221; approach that uses information from multiple previous steps to increase accuracy.<\/li>\n<li><a title=\"Milne's Method\" href=\"https:\/\/www.mathros.net.ua\/en\/\">Milne&#8217;s Method<\/a> &#8211; Another predictor-corrector method with a strong focus on numerical stability.<\/li>\n<\/ol>\n<p>Learning about these methods is a great idea if you want to pick the best tool for a particular problem.<\/p>\n<h2>Practical Reinforcement: Create Your Own Program<\/h2>\n<p>And of course, nothing helps you learn better than practice. Try implementing the Runge-Kutta method in your favorite programming language using a simple flowchart. This hands-on work will not only deepen your understanding of the theory but also let you experience how the method behaves in real numerical computations.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-10024093 aligncenter\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2025\/02\/runge-kutta-method14.jpg\" alt=\"runge-kutta method flowchart\" width=\"600\" height=\"467\" \/><\/p>\n<p>So roll up your sleeves, open your code editor, and dive into the world of numerical methods\u2014the Runge-Kutta method is your friendly guide toward finding accurate solutions to complex differential equations!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Numerical methods are often used to find approximate solutions to ordinary differential equations (ODEs), especially when an analytical solution is<\/p>\n","protected":false},"author":1,"featured_media":1344,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"template-centered.php","format":"standard","meta":{"footnotes":""},"categories":[207],"tags":[211,134,238,237,239],"class_list":["post-1343","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-solving-ordinary-differential-equations","tag-differential-equations","tag-numerical-methods","tag-ode-solver","tag-runge-kutta-method","tag-step-by-step-guide"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/posts\/1343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/comments?post=1343"}],"version-history":[{"count":4,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/posts\/1343\/revisions"}],"predecessor-version":[{"id":1697,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/posts\/1343\/revisions\/1697"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/media\/1344"}],"wp:attachment":[{"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/media?parent=1343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/categories?post=1343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/tags?post=1343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}