{"id":719,"date":"2024-10-26T07:21:38","date_gmt":"2024-10-26T07:21:38","guid":{"rendered":"https:\/\/www.mathros.net.ua\/en\/?p=719"},"modified":"2025-11-06T11:42:31","modified_gmt":"2025-11-06T11:42:31","slug":"jacobi-method","status":"publish","type":"post","link":"https:\/\/www.mathros.net.ua\/en\/jacobi-method.html","title":{"rendered":"Jacobi Method: How It Works and Why You Should Try It"},"content":{"rendered":"<p>Have you ever wondered how to find approximate solutions to a system of linear equations when direct methods become too complicated? The answer is simple &#8211; the Jacobi method! In this article, we&#8217;ll dive into how this iterative method works, the conditions necessary for its convergence, and how to apply it step by step. Together, we\u2019ll explore examples, the matrix form of the method, and examine when this approach is truly effective. Ready to learn more about the Jacobi method? Let\u2019s get started!<\/p>\n<h2>Jacobi Method: The Core Idea and How It Works<\/h2>\n<p>The Jacobi method is a numerical approach that allows you to find approximate solutions to systems of linear equations, step by step. Its main idea? Start with any initial values for the unknowns and gradually refine them. But how exactly does this work? At each step, we compute new values for each variable using the current values of the other variables. The iterations continue until the difference between consecutive results becomes so small that the solution can be considered accurate. It\u2019s a simple and effective method, especially for systems with many equations.<\/p>\n<h3>How Does the Jacobi Method Algorithm Work?<\/h3>\n<p>Let\u2019s take a closer look at how to implement the Jacobi method in practice. Imagine a system with <em>n<\/em> equations and <em>n<\/em> unknowns:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-10022483 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method1.jpg\" alt=\"system of n linear equations with n unknowns\" width=\"258\" height=\"71\" \/><\/p>\n<p>To use the Jacobi method, we assume that the diagonal coefficients <em>a<sub>ii<\/sub>\u22600<\/em> for all <em>i=1,\u2026,n<\/em>. We can then rewrite each equation in the system so that each variable can be calculated separately. For example, we solve the first equation for <em>x<sub>1<\/sub><\/em>, the second for <em>x<sub>2<\/sub><\/em>, the third for <em>x<sub>3<\/sub><\/em> and so on.<\/p>\n<p>The result is a new system of equations that looks like this:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-10022485 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method2.jpg\" alt=\"system of n linear equations with n unknowns\" width=\"256\" height=\"71\" \/><\/p>\n<p>Here, <em>\u03b2<sub>i<\/sub>=b<sub>i<\/sub>\/aii<\/em> and\u00a0 <em>\u03b1<sub>ij<\/sub>=-a<sub>ij<\/sub>\/a<sub>ii<\/sub><\/em> when <em>i\u2260j<\/em> and <em>\u03b1<sub>ij<\/sub>=0<\/em> when <em>i=j<\/em>.<\/p>\n<h3>What\u2019s Next? The Iterative Process in Action<\/h3>\n<p>Now, with the new equations in hand, we use them to calculate the variable values at each iteration step. First, we assume some initial values for all variables\u2014typically, this is just the column of constants <em>\u03b2<\/em>. On the first iteration, we compute new values:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-10022487 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method3.jpg\" alt=\"jacobi method for linear systems\" width=\"253\" height=\"19\" \/><\/p>\n<p>And similarly for the other variables. Then, for subsequent iterations, we repeat this process:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10022489 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method4.jpg\" alt=\"jacobi method for linear systems\" width=\"265\" height=\"19\" \/><\/p>\n<p>where <em>k<\/em> is the current iteration number. The iterations continue until the condition <em>|x<sup>(k+1)<\/sup>-x<sup>(k)<\/sup>|\u2264\u03b5<\/em>, where <em>\u03b5<\/em> is the desired accuracy, is met.<\/p>\n<h2>Jacobi Method in Matrix Form: Faster, Simpler, Easier<\/h2>\n<p>Working with individual equations at each iteration can be inconvenient, especially when the system has many variables. Therefore, the Jacobi method can also be expressed in matrix form, which makes calculations more structured. How does this look? It\u2019s simple! Let\u2019s rewrite the system of equations using matrices.<\/p>\n<p>We introduce two matrices:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10022491 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method5.jpg\" alt=\"jacobi method for linear systems\" width=\"246\" height=\"70\" \/><\/p>\n<p>Now, we can write the system in a convenient matrix form:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10022492 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method6.jpg\" alt=\"jacobi method for linear systems\" width=\"70\" height=\"14\" \/><\/p>\n<p>This is the form we use for iterations. We start with the initial approximation <em>x<sup>(0)<\/sup>=\u03b2<\/em> and then, at each step, compute a new approximation:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-10022527 aligncenter\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method16.jpg\" alt=\"jacobi method for linear systems\" width=\"330\" height=\"17\" \/><\/p>\n<p>At each iteration, we compute new values for all variables simultaneously, which significantly simplifies calculations compared to solving individual equations step by step.<\/p>\n<p>In general, for the <em>k<\/em>-th iteration, the formula looks like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10022495 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method7.jpg\" alt=\"jacobi method for linear systems\" width=\"108\" height=\"17\" \/><\/p>\n<p>The iterations continue until the difference between consecutive approximations becomes smaller than the set accuracy <em>\u03b5<\/em>. But what if the process doesn\u2019t converge? How do we ensure the success of the iterations? In the next section, we\u2019ll look at the key conditions for the Jacobi method&#8217;s convergence and how to check them to always get the correct results.<\/p>\n<h2>Convergence Conditions: How to Guarantee Iterative Success?<\/h2>\n<p>Applying the Jacobi method seems straightforward, but does it always give the correct result? Not quite. The key question here is the convergence of the iterations. Is it enough to simply start with any initial value? Or are there other factors to consider? Let\u2019s break it down.<\/p>\n<p>Interestingly, the initial approximation <em>x<sup>(0)<\/sup><\/em> can be chosen freely\u2014it doesn\u2019t have to be the column of constants <em>\u03b2<\/em>. However, the convergence of the process doesn\u2019t depend on this choice but rather on the properties of the matrix <em>\u03b1<\/em>. So even if you start with different approximations, the process will still lead you to the same correct solution, provided the algorithm converges. But what\u2019s the secret to convergence?<\/p>\n<p>For the Jacobi method to work, the matrix <em>\u03b1<\/em> must meet certain conditions. One key condition is that the sum of the absolute values of the elements in each row (or each column) of matrix <em>\u03b1<\/em>, except for the diagonal element, must be less than <em>1<\/em>. If at least one of the following conditions holds:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10022497 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method8.jpg\" alt=\"convergence conditions of the jacobi method\" width=\"272\" height=\"43\" \/><\/p>\n<p>then the iterative process will converge to a unique correct solution, regardless of where you start. This is an important point that guarantees the stability of calculations and a correct result.<\/p>\n<p>So, before starting the iterations, it\u2019s always useful to check these conditions. If they are met, you can be confident in the convergence of the process. And if not? Then you should either choose another numerical method or try to transform the system so that these conditions are satisfied.<\/p>\n<h2>Jacobi Method in Action: Examples to Help You Understand the Algorithm<\/h2>\n<p>Now it&#8217;s time to shift from theory to practice! Let\u2019s explore some examples to better understand how the Jacobi method works, what challenges might arise during the process, and why this method is particularly useful for large systems. Ready? Let\u2019s dive in!<\/p>\n<h6>Example 1: Why is the Jacobi Method a Great Choice?<\/h6>\n<p>The Jacobi method becomes essential when dealing with large systems of linear equations, where direct methods are either too complex or impractical. Because it relies on iterations, it\u2019s well-suited for cases that require quick approximations or when working with large datasets. An added benefit is that it\u2019s relatively simple to implement in code, making it a popular choice for numerical computations.<\/p>\n<h6>Example 2: What are the Limitations of the Jacobi Method?<\/h6>\n<p>However, the Jacobi method isn\u2019t without its limitations. It can be slow, especially if the system does not meet the necessary convergence conditions. For example, if the sum of the absolute values of each row or column (excluding the diagonal elements) is not less than <em>1<\/em>, the iterations may not converge. In such cases, you could spend a lot of time computing, only to find that the solution doesn\u2019t stabilize. This is why verifying the convergence conditions beforehand is crucial.<\/p>\n<h6>Example 3: Solve a System of Linear Equations Using the Jacobi Method with Precision \u03b5=0.1<\/h6>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10022500 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method9.jpg\" alt=\"jacobi method example problem\" width=\"206\" height=\"56\" \/><\/p>\n<p>First, we rewrite each equation to isolate one variable. This gives us the following system:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10022504 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method11.jpg\" alt=\"jacobi method example problem\" width=\"196\" height=\"56\" \/><\/p>\n<p>Let\u2019s assume the initial values are <em>x<sub>1<\/sub><sup>(0)<\/sup>=2<\/em>, <em>x<sub>2<\/sub><sup>(0)<\/sup>=1.3<\/em>, <em>x<sub>3<\/sub><sup>(0)<\/sup>=-0.9<\/em>, <em>x<sub>4<\/sub><sup>(0)<\/sup>=-0.2<\/em>. Now, let\u2019s perform the first iteration:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10022505 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method12.jpg\" alt=\"jacobi method example problem\" width=\"484\" height=\"77\" \/><\/p>\n<p>To determine whether we need more iterations, we compare the differences between the current and previous values. The maximum difference is:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-10022533 aligncenter\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method17.jpg\" alt=\"jacobi method example problem\" width=\"229\" height=\"23\" \/><\/p>\n<p>Since the difference exceeds the desired accuracy <em>\u03b5=0.1<\/em>, we need to continue iterating. On the second iteration:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-10022534 aligncenter\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method18.jpg\" alt=\"jacobi method example problem\" width=\"483\" height=\"77\" \/><\/p>\n<p>The new maximum difference is:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-10022535 aligncenter\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method19.jpg\" alt=\"jacobi method example problem\" width=\"236\" height=\"23\" \/><\/p>\n<p>We\u2019ll need several more iterations. After eight iterations, we finally achieve the required precision, and these values are accepted as the solution to the system:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10022508 size-full\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method14.jpg\" alt=\"jacobi method example problem\" width=\"612\" height=\"490\" \/><\/p>\n<h2>See Also: Other Iterative Methods Worth Knowing<\/h2>\n<p>The Jacobi method is just one of many fascinating numerical approaches to solving systems of linear equations. If you\u2019re excited to explore further, here are a few other iterative methods you might find interesting:<\/p>\n<ol>\n<li><a title=\"Gauss-Seidel Method\" href=\"https:\/\/www.mathros.net.ua\/en\/gauss-seidel-method.html\">Gauss-Seidel Method<\/a> &#8211; A modification of the Jacobi method that uses updated variable values within the same iteration, speeding up convergence.<\/li>\n<li><a title=\"Successive Over-Relaxation\" href=\"https:\/\/www.mathros.net.ua\/en\/successive-over-relaxation-iterative-method.html\">Successive Over-Relaxation (SOR)<\/a> &#8211; Adds a relaxation parameter to accelerate convergence or stabilize the process for complex systems.<\/li>\n<li><a title=\"Gradient Descent Method\" href=\"https:\/\/www.mathros.net.ua\/en\/\">Gradient Descent Method<\/a> &#8211; Uses the steepest descent direction to find solutions, particularly useful for large and sparse systems.<\/li>\n<\/ol>\n<h2>Automating the Jacobi Method: A Step Toward Efficiency<\/h2>\n<p>Why not combine mathematics with programming? The Jacobi method offers a great opportunity to create a program that automates solving <a title=\"System of linear equations\" href=\"https:\/\/en.wikipedia.org\/wiki\/System_of_linear_equations\" target=\"_blank\" rel=\"nofollow noopener\">systems of linear equations<\/a>. Below is a flowchart that outlines the process step by step\u2014from inputting matrices and initial guesses to checking for convergence and obtaining the solution. Automating this process not only saves time but also gives you a convenient tool for quickly solving complex problems. Make math even simpler\u2014turn it into code!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-10022540 aligncenter\" src=\"https:\/\/www.mathros.net.ua\/en\/wp-content\/uploads\/2024\/10\/jacobi-method20.jpg\" alt=\"jacobi method flowchart\" width=\"600\" height=\"938\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever wondered how to find approximate solutions to a system of linear equations when direct methods become too<\/p>\n","protected":false},"author":1,"featured_media":721,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"template-centered.php","format":"standard","meta":{"footnotes":""},"categories":[118],"tags":[130,129,128,131,132],"class_list":["post-719","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-solving-systems-of-linear-equations","tag-approximate-solutions-method","tag-iterative-methods","tag-jacobi-method","tag-large-system-solver","tag-solving-systems-iteratively"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/posts\/719","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=719"}],"version-history":[{"count":4,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/posts\/719\/revisions"}],"predecessor-version":[{"id":851,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/posts\/719\/revisions\/851"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/media\/721"}],"wp:attachment":[{"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/media?parent=719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/categories?post=719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mathros.net.ua\/en\/wp-json\/wp\/v2\/tags?post=719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}