# Solve systems of linear equations Ax = B for x

조회 수: 306(최근 30일)
Johan Johan 29 Aug 2019
x = A\B solves the system of linear equations A*x = B. The matrices A and B must have the same number of rows.
But ,what is the operation between the rows?
There is any one can solve this example–manually ?
A =
1 3
4 2
b= [6 ;7];
>> A\b
ans =
0.9000
1.7000
How to find 0.9 and 1.7 exactly?

댓글을 달려면 로그인하십시오.

### 채택된 답변

Stephen Cobeldick 29 Aug 2019
편집: Stephen Cobeldick 29 Aug 2019
"But ,what is the operation between the rows?"
Both mldivide and mrdivide can use many different algorithms for solving systems of linear equations, as documented in the mldivide documentation. There is no single "operation" that describes all of those algorithms.
"There is any one can solve this example–manually ?"
This is easy using standard definitions for solving linear equations, e.g. elimination of variables:
System definition:  First solve the first equation for x: Second, substitute x back into the second equation: Third, solve that for y:     And finally try them with your example values:
>> A = [1,3;4,2]
A =
1 3
4 2
>> b = [6;7]
b =
6
7
>> A\b
ans =
0.9
1.7
>> y = (A(1,1)*b(2)-A(2,1)*b(1)) ./ (A(1,1)*A(2,2)-A(2,1)*A(1,2))
y =
1.7
>> x = (b(1)-A(1,2)*y) ./ A(1,1)
x =
0.9

댓글을 달려면 로그인하십시오.

### 추가 답변(2개)

KALYAN ACHARJYA 29 Aug 2019
편집: KALYAN ACHARJYA 29 Aug 2019
ans =
0.9000
1.7000
How to find 0.9 and 1.7 exactly??
format shortg;
A =[1 3
4 2];
b= [6 ;7];
A\b
Result:
ans =
0.9
1.7

#### 댓글 수: 0

댓글을 달려면 로그인하십시오.

Torsten 29 Aug 2019
https://en.wikipedia.org/wiki/Cramer%27s_rule

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!