# Find all possible ordered pairs that satisfy a linear equation

2 views (last 30 days)
Kathleen Horvath on 16 May 2021
Answered: Star Strider on 16 May 2021
I am trying to find all possible combinations of X and Y that satisfy the following linear equation:
f = ((X*25)+(Y*(24))) == 100
The variables should only be evaluated in the following range:
1 ≤ X ≥ 7 and 0.1 ≤ Y ≥ 3 or put another way X = 1:0.01:7 and Y = 0.1:0.01:3
I assume there are multiple simple ways to solve this using either for loops or syms approaches.

Star Strider on 16 May 2021
The ‘all possible’ criterion would produce infinite solutions. I suspect you would spend the rest of your life calculationg it!
Here is a slightly more limited calculation —
B = 1;
k = 1;
while (B>=0.1) & (B<=7)
X(k,:) = k/10;
B = (100 - X(k,:)*25)/24;
Y(k,:) = B;
k = k+1;
end
Result = table(X,Y)
Result = 40×2 table
X Y ___ ______ 0.1 4.0625 0.2 3.9583 0.3 3.8542 0.4 3.75 0.5 3.6458 0.6 3.5417 0.7 3.4375 0.8 3.3333 0.9 3.2292 1 3.125 1.1 3.0208 1.2 2.9167 1.3 2.8125 1.4 2.7083 1.5 2.6042 1.6 2.5
.