# Seeking a one-line command (v. 10) to solve for x[s_] and y[s_] in the following equation: 3x+4y=1+5s. The answes are x=-1+3s and y=1-s [closed]

Seeking a one-line command (v. 10) to solve for x[s_] and y[s_] in the following equation: 3x+4y=1+5s. The answes are x=-1+3s and y=1-s.

• How do you get two solutions from one equation? – anderstood Sep 14 at 21:45
• @Ninos: There are infinite solutions. You have $$3(a + bs) + 4(c + d s) = 1 + 5s$$ We get $$3 a + 4c = 1 \\ 3b + 4d = 5$$ $c$ and $d$ are free variables - choose whatever you'd like and then solve for $a$ and $b$. – Moo Sep 14 at 22:15
• You can get them with sol = First[SolveAlways[3 (a + p s) + 4 (b + q s) == 1 + 5 s, s]] then choose any b,q you want to find a particular solution. Choosing b==25, q==-64 we have {b -> 25, q -> -64, a -> -33, p -> 87}. You can then check the result easily with Simplify[3 (a + p s) + 4 (b + q s) /. Join[#, sol /. #] &@{b -> 25, q -> -64}] – flinty Sep 14 at 22:16
• since there are lots of integer u,v satisfied 3u+4v=1,we can set x=(1+5s)u, y=(1+5s)v. For example,we assume u=-1,v=1,so x=-(1+5s),y=1+5s – cvgmt Sep 15 at 0:56

Minimize [{x^2 + y^2, 3 x + 4 y == 1 + 5 s}, {x, y}] // Simplify