Domain and Range Restrictions

To limit the domain or range (x or y values of a graph), you can add the restriction to the end of your equation in curly brackets {}. For example, y=2x{0<x<3} would graph the line y=2x for x values between 0 and 3.

To try it out in Desmos, click the Restrictions Tour in the help menu:


Was this article helpful?
9 out of 11 found this helpful
Have more questions? Submit a request


  • Avatar
    Brendon Hackett

    that is very helpful, can you show us how to do a step peicewise?

  • Avatar
    Fabrice Neyret


    • you can cumulate conditions:    y = sin ( x/a )   { a > 0 } { 0 <= x <= a*pi }

    • for parametrics curve, the condition must be *in* the parenthesis:  ( t,  sin ( t/a )   { a > 0 }  )

    • you can also use the  "if elseif else" version :  y = { a <= 0 : 0 ,   0 <= x <= a*pi  : sin ( x/a )  , 0 )

      with any number of cond : expression terms, and the default (final) expression is not mandatory

  • Avatar
    Alexandre Gurchumelia

    It's missing the very important part, making piecewise function in single line, so that when you differentiate it or use it in any why elsewhere, the function remains whole. Syntax is:

    F(x)={x≤0 : x², 0<x<π/2 : 2x/π, x≥π/2 : sin(x)}

    Now it's usable in any situation, for instance:

  • Avatar
    Tom De Vries

    yes,  I was sad about this too,  had some previously produced graphs that are now broken, though I respect the fact that some other things are much easier.  

    How would you create a piecewise function in one line.   Not just for differentiation, but also to illustrate transformations as in this (previously working)  example