### 5.53.6 Solving equation(s): solve

solve solves an equation or a system of polynomial equations. It takes 2 arguments:

- Solving an equation
  solve takes as arguments an equation between two expressions or an expression (=0 is omitted), and a variable name (by default x).
  solve solves this equation.
- Solving a system of polynomial equations
  solve takes as arguments two vectors : a vector of polynomial equations and a vector of variable names.
  solve solves this polynomial equation system.

Remarks:

- In real mode, solve returns only real solutions. To have the complex solutions, switch to complex mode, e.g. by checking Complex in the cas configuration, or use the cSolve command.
- For trigonometric equations, solve returns by default the principal solutions. To have all the solutions check All_trig_sol in the cas configuration.

Examples :

- Solve x4−1=3
  Input :
  solve(x`^`4-1=3)
  Output in real mode :
  [sqrt(2),-(sqrt(2))]
  Output in complex mode :
  [sqrt(2),-(sqrt(2)),(i)*sqrt(2),-((i)*sqrt(2))]
- Solve exp(x)=2
  Input :
  solve(exp(x)=2)
  Output in real mode :
  [log(2)]
- Find x,y such that x+y=1,x−y=0
  Input :
  solve([x+y=1,x-y],[x,y])
  Output :
  [[1/2,1/2]]
- Find x,y such that x2+y=2,x+y2=2
  Input :
  solve([x`^`2+y=2,x+y`^`2=2],[x,y])
  Output :
  [[-2,-2],[1,1],[(-sqrt(5)+1)/2,(1+sqrt(5))/2],
  [(sqrt(5)+1)/2,(1-sqrt(5))/2]]
- Find x,y,z such that x2−y2=0,x2−z2=0
  Input :
  solve([x`^`2-y`^`2=0,x`^`2-z`^`2=0],[x,y,z])
  Output :
  [[x,x,x],[x,-x,-x],[x,-x,x],[x,x,-x]]
- Solve cos(2*x)=1/2
  Input :
  solve(cos(2*x)=1/2)
  Output :
  [pi/6,(-pi)/6]
  Output with All_trig_sol checked :
  [(6*pi*n_0+pi)/6,(6*pi*n_0-pi)/6]
- Find the intersection of a straight line (given by a list of equations) and a plane.
  For example, let D be the straight line of cartesian equations [y−z=0,z−x=0] and let P the plane of equation x−1+y+z=0. Find the intersection of D and P.
  Input :
  solve([[y-z=0,z-x=0],x-1+y+z=0],[x,y,z])
  Output :
  [[1/3,1/3,1/3]]