free page hit counter
How To Write Piecewise Functions In Desmos

Hey there, graph enthusiast! Grab a coffee, pull up a chair, and let's chat about piecewise functions in Desmos. You know, those functions that look like they've been through a blender, all chopped up into little bits? Yeah, those.

First Things First: What's a Piecewise Function?

Imagine you're on a road trip, and the speed limit keeps changing. You're going 60 mph until you hit the city, then it's 35, and then it's back to 60. That's basically a piecewise function - it's a function that's defined differently depending on where you are (or in math terms, depending on the input).

Now, let's get our hands dirty with Desmos. Fire it up, and let's create a simple piecewise function together. We'll use a lightbulb to represent when it's day or night. When it's day (x > 0), the lightbulb is on. When it's night (x ≤ 0), it's off. Easy peasy!

Step 1: Start with a Simple Function

Click on the 'Graph' tab, then 'New Graph'. Let's start with a simple function, like y = x. Click on the 'Expression' box, type it in, and hit enter. Now we've got a straight line from (-∞, ∞).

But we want a lightbulb, not a line. So, let's change that function to y = 1. Now we've got a horizontal line at y = 1. Not quite a lightbulb, but we're getting there.

Desmos to graph Piecewise Functions and Evaluate with Function NotationDesmos to graph Piecewise Functions and Evaluate with Function Notation

Step 2: Add a Piecewise Condition

Now, let's make it piecewise. Click on the 'Expression' box again. Instead of typing a single function, we're going to type two. Separate them with a comma and an 'if' statement. So, it should look like this: y, if x > 0, then 1, else 0.

Let's break that down. It's saying, "If x is greater than 0, then y is 1. Otherwise (else), y is 0." Hit enter, and voila! You've just created your first piecewise function in Desmos. Isn't that cute?

But Wait, There's More!

What if you want to add more pieces to your function? Let's say our lightbulb also turns on for a moment at sunset (x = -1). We can add another 'if' statement. Here's how you do it: y, if x > 0, then 1, if x = -1, then 1, else 0.

How to do piecewise functions on Desmos Graph Calculator?How to do piecewise functions on Desmos Graph Calculator?

See how we just added another condition? It's like adding another speed limit sign on our road trip. Just make sure to keep your conditions in order, from most specific to least. Desmos will use the first condition that fits.

Bonus: Making It Fancy

Now, let's make our lightbulb a little fancier. Click on the 'Style' tab. You can change the color, line style, and even add a label. Make it your own little masterpiece!

And there you have it! You're now a piecewise function pro. Go forth and create those crazy, chopped-up functions. Just remember, the key to piecewise functions is keeping your conditions in order. And if you get stuck, just think of it like a road trip. Each condition is a new speed limit sign, and you've got to follow them in order. Happy graphing!