General Solution to n*n Linear Equation

Daniel94

New member
Joined
Apr 28, 2022
Messages
4
Hello everyone,
first post here, hope this is the right subforum for my question.

For a mass optimization porblem in engineering I have a set of equations:
[math]\left( \begin{matrix} K_1 & 1 & ... & 1\\ 1 & K_2 & ... & 1\\ ... & ... & ... & ...\\ 1 & 1 & ... & K_n \end{matrix} \right )* \left( \begin{matrix} k_1\\ k_2\\ ... .\\ k_n \end{matrix} \right ) = \left( \begin{matrix} 1\\ 1\\ 1\\ 1 \end{matrix} \right )[/math]for which I would need a general solution (for k_n).

Does anyone know how I could get to this? I tried it out with a variety of matrix sizes to figure out a pattern, and while there is one visible, I don't get how to write it in a general form as a sum or a product.

any help is highly appreciated.

Daniel
 
Additional Information, this is what I tried:

for n=2:
[math]k_2=\frac{K_1-1}{K_1K_2-1}[/math]for n=3:
[math]k_3= \frac{(1-K_1)(1-K_2)}{K_1K_2K_3-K_1-K_2-K_3+2} [/math]for n=4:
[math]k_4=\frac{-(1-K_1)(1-K_2)(1-K_3)}{K_1K_2K_3K_4-K_1K_2-K_1K_3-K_1K_4-K_2K_3-K_2K_4-K_3K_4+2K_1+2K_2+2K_3+2K_4-3}[/math]it appears that the numerator of the solution can be represented as
[math]\frac{-1^{n-1}}{(1-K_i)}\prod_{j= 1}^{n} (1-K_j)[/math]
but I dont know how to represent the denominator as a series!
 
I haven't verified this, but playing with SymPy produced this formula:
[math]k_n = \frac{1}{K_n - (1-K_n)\sum_{j=1}^{n-1} \frac{1}{K_j-1}}[/math]Please let me know if it fits your expressions.
 
Hello everyone,
first post here, hope this is the right subforum for my question.

For a mass optimization porblem in engineering I have a set of equations:
[math]\left( \begin{matrix} K_1 & 1 & ... & 1\\ 1 & K_2 & ... & 1\\ ... & ... & ... & ...\\ 1 & 1 & ... & K_n \end{matrix} \right )* \left( \begin{matrix} k_1\\ k_2\\ ... .\\ k_n \end{matrix} \right ) = \left( \begin{matrix} 1\\ 1\\ 1\\ 1 \end{matrix} \right )[/math]for which I would need a general solution (for k_n).

Does anyone know how I could get to this? I tried it out with a variety of matrix sizes to figure out a pattern, and while there is one visible, I don't get how to write it in a general form as a sum or a product.

any help is highly appreciated.

Daniel
[imath]\left( \begin{matrix} K_1 & 1 & ... & 1\\ 1 & K_2 & ... & 1\\ ... & ... & ... & ...\\ 1 & 1 & ... & K_n \end{matrix} \right )* \left( \begin{matrix} k_1\\ k_2\\ ... .\\ k_n \end{matrix} \right ) = \left( \begin{matrix} 1\\ 1\\ 1\\ 1 \end{matrix} \right )[/imath]

[imath]\left( \begin{matrix} K_1 & 1 & ... & 1\\ 1 & K_2 & ... & 1\\ ... & ... & ... & ...\\ 1 & 1 & ... & K_n \end{matrix} \right )^{-1} ~ \left( \begin{matrix} K_1 & 1 & ... & 1\\ 1 & K_2 & ... & 1\\ ... & ... & ... & ...\\ 1 & 1 & ... & K_n \end{matrix} \right )* \left( \begin{matrix} k_1\\ k_2\\ ... .\\ k_n \end{matrix} \right ) = \left( \begin{matrix} K_1 & 1 & ... & 1\\ 1 & K_2 & ... & 1\\ ... & ... & ... & ...\\ 1 & 1 & ... & K_n \end{matrix} \right )^{-1} ~ \left( \begin{matrix} 1\\ 1\\ 1\\ 1 \end{matrix} \right )[/imath]

[imath]\left( \begin{matrix} k_1\\ k_2\\ ... .\\ k_n \end{matrix} \right ) = \left( \begin{matrix} K_1 & 1 & ... & 1\\ 1 & K_2 & ... & 1\\ ... & ... & ... & ...\\ 1 & 1 & ... & K_n \end{matrix} \right )^{-1} ~ \left( \begin{matrix} 1\\ 1\\ 1\\ 1 \end{matrix} \right )[/imath]

How can you find the inverse matrix? Try a couple of n's and see if you can find a pattern.

-Dan
 
Here is the derivation:

[math]\left( \begin{array}{ccccc} K_1 & 1 & 1 & ... & 1\\ 1 & K_2 & 1 & ... & 1\\ 1 & 1 & K_3 & ... & 1\\ ... & ... & ... & ... & ... \\ 1 & 1 & 1 & ... & K_n \end{array}\right) \left( \begin{array}{c} k_1\\k_2\\k_3\\...\\k_n \end{array}\right) \left( = \begin{array}{c} 1\\1\\1\\...\\1 \end{array}\right)[/math]
Subtract the last row from all other rows in order to zero most of the the lower left
triangle (except the last row):

[math]\left( \begin{array}{ccccc} K_1 -1& 1 & 0 & ... & 1 - K_n\\ 0 & K_2 -1 & 0 & ... & 1 -K_n\\ 0 & 0 & K_2 & ... & 1 - K_n\\ ... & ... & ... & ... & ... \\ 1 & 1 & 1 & ... & K_n \end{array}\right) \left( \begin{array}{c} k_1\\k_2\\k_3\\...\\k_n \end{array}\right) \left( = \begin{array}{c} 0\\0\\0\\...\\1 \end{array}\right)[/math]
Now subtract scaled rows from the last in order to zero the last row of the lower left triangle:

[math]\left( \begin{array}{ccccc} K_1 -1& 1 & 0 & ... & 1 - K_n\\ 0 & K_2 -1 & 0 & ... & 1 -K_n\\ 0 & 0 & K_2 & ... & 1 - K_n\\ ... & ... & ... & ... & ... \\ 0 & 0 & 0 & ... & A \end{array}\right) \left( \begin{array}{c} k_1\\k_2\\k_3\\...\\k_n \end{array}\right) \left( = \begin{array}{c} 0\\0\\0\\...\\1 \end{array}\right)[/math]
where

[math]A = K_n - \sum_{j=1}^{n-1} \frac{1-K_n}{K_1-1} \;\;\;\;\;\; = K_n - (1-K_n)\sum_{j=1}^{n-1} \frac{1}{K_1-1}[/math]
[math]k_n = \frac{1}{A}[/math]
 
How can you find the inverse matrix? Try a couple of n's and see if you can find a pattern.

-Dan
Dear Dan,

Thanks a lot for your reply!
I tried it out as you suggested, but ran into the same problem - I was able to calculate the inverse matrix for up to n=3, but it got very big very soon and I was not able to figure out the pattern.
 
Here is the derivation:

[math]\left( \begin{array}{ccccc} K_1 & 1 & 1 & ... & 1\\ 1 & K_2 & 1 & ... & 1\\ 1 & 1 & K_3 & ... & 1\\ ... & ... & ... & ... & ... \\ 1 & 1 & 1 & ... & K_n \end{array}\right) \left( \begin{array}{c} k_1\\k_2\\k_3\\...\\k_n \end{array}\right) \left( = \begin{array}{c} 1\\1\\1\\...\\1 \end{array}\right)[/math]
Subtract the last row from all other rows in order to zero most of the the lower left
triangle (except the last row):

[math]\left( \begin{array}{ccccc} K_1 -1& 1 & 0 & ... & 1 - K_n\\ 0 & K_2 -1 & 0 & ... & 1 -K_n\\ 0 & 0 & K_2 & ... & 1 - K_n\\ ... & ... & ... & ... & ... \\ 1 & 1 & 1 & ... & K_n \end{array}\right) \left( \begin{array}{c} k_1\\k_2\\k_3\\...\\k_n \end{array}\right) \left( = \begin{array}{c} 0\\0\\0\\...\\1 \end{array}\right)[/math]
Now subtract scaled rows from the last in order to zero the last row of the lower left triangle:

[math]\left( \begin{array}{ccccc} K_1 -1& 1 & 0 & ... & 1 - K_n\\ 0 & K_2 -1 & 0 & ... & 1 -K_n\\ 0 & 0 & K_2 & ... & 1 - K_n\\ ... & ... & ... & ... & ... \\ 0 & 0 & 0 & ... & A \end{array}\right) \left( \begin{array}{c} k_1\\k_2\\k_3\\...\\k_n \end{array}\right) \left( = \begin{array}{c} 0\\0\\0\\...\\1 \end{array}\right)[/math]
where

[math]A = K_n - \sum_{j=1}^{n-1} \frac{1-K_n}{K_1-1} \;\;\;\;\;\; = K_n - (1-K_n)\sum_{j=1}^{n-1} \frac{1}{K_1-1}[/math]
[math]k_n = \frac{1}{A}[/math]
Awesome, thank you a lot!
I was just trying your method for n=3 and it fits, but I was unable to get any proof for it.
Now it all makes sense, it's so obvious! thank you very much :)

In general form I can now write
[math]k_i = (K_i - (1-K_i)\sum_{j=1}^{n} \frac{1}{K_j-1}-1)^{-1}[/math]
 
Last edited:
Dear Dan,

Thanks a lot for your reply!
I tried it out as you suggested, but ran into the same problem - I was able to calculate the inverse matrix for up to n=3, but it got very big very soon and I was not able to figure out the pattern.
My apologies. I was using Mathematica wrong. There is a pattern but it's a bit on the complex side. blamocur's suggestion will get you there much more easily.

-Dan
 
Top