Student[Basics] - Maple Programming Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Education : Student Package : Basics : Student/Basics/LinearSolveSteps





generates core steps for solving equations for a given variable


Calling Sequence



Package Usage



Calling Sequence

Student[Basics][LinearSolveSteps]( expr, var )

Student[Basics][LinearSolveSteps]( expr, var, implicitmultiply = true )




string or expression



symbol (variable to solve for)



truefalse (optional)



The LinearSolveSteps command accepts an expression, expr in the given variable, var, and displays the steps required to solve for that variable.


Note that this command also accepts some nonlinear equations that can be reduced down to linear equations (in other words, you can isolate x on one side of the equation, and there is only one solution).


If expr is a string, then it is parsed into an expression using InertForm:-Parse so that no automatic simplifications are applied, and thus no steps are missed.  


The implicitmultiply option is only relevant when expr is a string.  This option is passed directly on to the InertForm:-Parse command and will cause things like "2x" to be interpreted as 2*x, but also, "xyz" to be interpreted as x*y*z.


A step may show up where the expression is not obviously different from the previous step.  This can happen when the underlying data structure is transformed during the step, and it is not obvious that the resulting structure is the same as the original, but just expressed differently.  This becomes more apparent when looking at the inert-form of the raw data.


The return value is a module that display annotated steps by default.  This module also has callable methods and data members: data, numsteps, step, and toMathML.  

data: a numsteps x 2 array where column 1 is the inert-form expression, and column 2 is the annotation.  R:-data[1,1] is the original expression in inert-form.

numsteps: the number of steps in the solution, including the original expression.  

step(i): a method for displaying individual steps.  Calling R:-step(i) will display the ith typeset expression and annotation.  Step 1 is the original expression.

toMathML(): a method for converting the sequence of steps and annotations into mathml.  The toMathML command optionally takes one or two arguments: (1) a filename, indicating the mathml should be written to the specified file, and (2) the option htmlheader=true, which will also cause html tags to be written along with the mathml, thus generating a complete .html page that can be loaded in a browser.

Package Usage


This function is part of the Student[Basics] package, so it can be used in the short form LinearSolveSteps(..) only after executing the command with(Student[Basics]). However, it can always be accessed through the long form of the command by using Student[Basics][LinearSolveSteps](..).




x+12yz=4y2z+3xyx+12yz3xy=4y2zsubtract from both sidesyx+12yzy+2yz3x2yzy=4y2zfind common denominatoryx+1+2yz3x2yzy=4y2zsum over common denominatoryx+y·1+2yz3x2yzy=4y2zdistributive multiplyyx+y+−6yzx2yzy=4y2zmultiply constants6yzx+yx+y2yzy=4y2zreorder termsy6xz+x+1y·2yz=4y2zfactor6xz+x+12yz=4y2zdivide6xz+x+1=2yz4y2zmultiply rhs by denominator of lhs6xz+x=2yz4y2z1subtract from both sides6xz+x=8y3zz1multiply fraction6xz+x=8y31dividex16z=8y31factorx=8y3116zdivide both sides


Note that the result is a module with callable methods


exx−112=34+−2xx−1−2x=34+12subtract from both sides1x+2x=34+12distribute negation3x=34+12add terms3x=54add termsx3=45reciprocal of both sidesx=4513divide both sidesx=4531rewrite division as multiplication by reciprocalx=125multiply fraction and reduce by gcd






x−1−2x=34+12subtract from both sides



<math xmlns=''><mstyle scriptminsize='8.0pt'><mrow><mrow><mrow><mi>^</mi><mo></mo><mfenced><mi>x</mi><mn>-1</mn></mfenced></mrow><mo>+</mo><mfrac><mn>-1</mn><mn>2</mn></mfrac></mrow><mo>=</mo><mrow><mfrac><mn>3</mn><mn>4</mn></mfrac><mo>+</mo><mfenced><mrow><mo>-</mo><mfrac><mn>2</mn><mi>x</mi></mfrac></mrow></mfenced></mrow></mrow></mstyle></math> <math xmlns=''><mstyle scriptminsize='8.0pt'><mrow><mrow><mrow><mi>^</mi><mo></mo><mfenced><mi>x</mi><mn>-1</mn></mfenced></mrow><mo>+</mo><mfrac><mn>2</mn><mi>x</mi></mfrac></mrow><mo>=</mo><mrow><mfrac><mn>3</mn><mn>4</mn></mfrac><mo>+</mo><mfrac><mn>1</mn><mn>2</mn></mfrac></mrow></mrow><mspace width='10px'><mtext color='blue'>( subtract from both sides )</mtext></mstyle></math> <math xmlns=''><mstyle scriptminsize='8.0pt'><mrow><mrow><mfrac><mn>1</mn><mi>x</mi></mfrac><mo>+</mo><mfrac><mn>2</mn><mi>x</mi></mfrac></mrow><mo>=</mo><mrow><mfrac><mn>3</mn><mn>4</mn></mfrac><mo>+</mo><mfrac><mn>1</mn><mn>2</mn></mfrac></mrow></mrow><mspace width='10px'><mtext color='blue'>( distribute negation )</mtext></mstyle></math> <math xmlns=''><mstyle scriptminsize='8.0pt'><mrow><mfrac><mn>3</mn><mi>x</mi></mfrac><mo>=</mo><mrow><mfrac><mn>3</mn><mn>4</mn></mfrac><mo>+</mo><mfrac><mn>1</mn><mn>2</mn></mfrac></mrow></mrow><mspace width='10px'><mtext color='blue'>( add terms )</mtext></mstyle></math> <math xmlns=''><mstyle scriptminsize='8.0pt'><mrow><mfrac><mn>3</mn><mi>x</mi></mfrac><mo>=</mo><mfrac><mn>5</mn><mn>4</mn></mfrac></mrow><mspace width='10px'><mtext color='blue'>( add terms )</mtext></mstyle></math> <math xmlns=''><mstyle scriptminsize='8.0pt'><mrow><mrow><mfrac><mn>1</mn><mn>3</mn></mfrac><mo> </mo><mi>x</mi></mrow><mo>=</mo><mfrac><mn>4</mn><mn>5</mn></mfrac></mrow><mspace width='10px'><mtext color='blue'>( reciprocal of both sides )</mtext></mstyle></math> <math xmlns=''><mstyle scriptminsize='8.0pt'><mrow><mi>x</mi><mo>=</mo><mrow><mfrac><mn>4</mn><mn>5</mn></mfrac><mo> </mo><mfrac><mn>1</mn><mi>1/3</mi></mfrac></mrow></mrow><mspace width='10px'><mtext color='blue'>( divide both sides )</mtext></mstyle></math> <math xmlns=''><mstyle scriptminsize='8.0pt'><mrow><mi>x</mi><mo>=</mo><mrow><mfrac><mn>4</mn><mn>5</mn></mfrac><mo> </mo><mfrac><mn>3</mn><mn>1</mn></mfrac></mrow></mrow><mspace width='10px'><mtext color='blue'>( rewrite division as multiplication by reciprocal )</mtext></mstyle></math> <math xmlns=''><mstyle scriptminsize='8.0pt'><mrow><mi>x</mi><mo>=</mo><mfrac><mn>12</mn><mn>5</mn></mfrac></mrow><mspace width='10px'><mtext color='blue'>( multiply fraction and reduce by gcd )</mtext></mstyle></math>


The input can be a string, which prevents automatic simplification

LinearSolveStepsx + 3^2 = 12&comma;x

x+32=12x=1232subtract from both sidesx=129evaluate powerx=3add terms


The implicitmultiply option allows short-hand for string input.

LinearSolveSteps3(x-2) = 0&comma;x&comma;&apos;implicitmultiply&apos;

3x2=03x+3−2=0distributive multiply3x6=0multiply constants3x=6subtract from both sidesx=63divide both sidesx=2reduce fraction by gcd




The Student[Basics][LinearSolveSteps] command was introduced in Maple 18.


For more information on Maple 18 changes, see Updates in Maple 18.

See Also