Una funzione può cambiare “formula” a seconda dell’intervallo in cui cade xx: sono le funzioni definite a tratti, che avevamo già incontrato studiando il valore assoluto. Qui le trattiamo come oggetto autonomo: la definizione con il sistema di casi, come costruirle e disegnarle, il controllo della continuità nei punti di raccordo e il loro uso come modelli reali (tariffe a scaglioni, costi con franchigia).

A function can change “formula” depending on the interval in which xx falls: these are piecewise functions, which we had already met when studying the absolute value. Here we treat them as an object in their own right: the definition using the system of cases, how to build and draw them, checking continuity at the junction points and their use as real-world models (tiered tariffs, costs with a free allowance).

Una funzione definita a tratti (o a pezzi) è una funzione che cambia “formula” a seconda di in quale intervallo cade xx. Le abbiamo già incontrate nello studio del valore assoluto: ora le trattiamo come oggetto autonomo.

Definizione — Funzione definita a tratti

Una funzione f ⁣:DRf\colon D\to\mathbb{R} è definita a tratti se DD è suddiviso in nn intervalli I1,,InI_1,\ldots,I_n con D=I1InD=I_1\cup\cdots\cup I_n e su ciascun IkI_k si assegna una formula fk(x)f_k(x): f(x)={f1(x)xI1,f2(x)xI2,fn(x)xIn.f(x) = \begin{cases} f_1(x) & x\in I_1, \\ f_2(x) & x\in I_2, \\ \vdots & \\ f_n(x) & x\in I_n. \end{cases}

Esempio — Funzione segno

sgn(x)={+1x>0,0x=0,1x<0.\operatorname{sgn}(x) = \begin{cases} +1 & x>0, \\ 0 & x=0, \\ -1 & x<0. \end{cases} Tre tratti costanti. Non è continua in x=0x=0: salto di altezza 22.

Esempio — Valore assoluto come funzione a tratti

x={xx0xx<0|x|=\begin{cases} x & x\ge 0 \\ -x & x<0\end{cases}. Due tratti lineari che si incontrano in (0,0)(0,0) con la stessa altezza: continua ma non derivabile in 00 (punto angoloso, che vedremo in Quinta).

Collegamenti

Argomenti: Funzioni proprieta
Concetti: Funzione definita a tratti · Funzione segno · Valore assoluto
Funzioni: Funzione segno · Valore assoluto

A piecewise function (or piecewise-defined function) is a function that changes “formula” depending on which interval xx falls into. We have already met them in the study of the absolute value: now we treat them as an object in their own right.

Definition — Piecewise function

A function f ⁣:DRf\colon D\to\mathbb{R} is piecewise defined if DD is split into nn intervals I1,,InI_1,\ldots,I_n with D=I1InD=I_1\cup\cdots\cup I_n and on each IkI_k a formula fk(x)f_k(x) is assigned: f(x)={f1(x)xI1,f2(x)xI2,fn(x)xIn.f(x) = \begin{cases} f_1(x) & x\in I_1, \\ f_2(x) & x\in I_2, \\ \vdots & \\ f_n(x) & x\in I_n. \end{cases}

Example — Sign function

sgn(x)={+1x>0,0x=0,1x<0.\operatorname{sgn}(x) = \begin{cases} +1 & x>0, \\ 0 & x=0, \\ -1 & x<0. \end{cases} Three constant pieces. It is not continuous at x=0x=0: a jump of height 22.

Example — Absolute value as a piecewise function

x={xx0xx<0|x|=\begin{cases} x & x\ge 0 \\ -x & x<0\end{cases}. Two linear pieces meeting at (0,0)(0,0) at the same height: continuous but not differentiable at 00 (a corner point, which we shall see in Year Five).

Topics: Functions and properties
Concepts: Piecewise function · Sign function · Absolute value
Functions: Sign function · Absolute value

Per disegnare una funzione a tratti si traccia ciascun pezzo solo sul proprio intervallo, prestando attenzione ai punti di raccordo.

Esempio — Costruzione

f(x)={x+2x1x21<x<24x2f(x)=\begin{cases} x+2 & x\le -1 \\ x^2 & -1<x<2 \\ 4 & x\ge 2\end{cases} Dominio: tutto R\mathbb{R} (i tre tratti coprono (,1](1,2)[2,+)=R(-\infty,-1]\cup(-1,2)\cup[2,+\infty)=\mathbb{R}). Tratti: retta, parabola, costante. Nei punti di raccordo x=1x=-1 e x=2x=2 i tratti hanno la stessa altezza (11 e 44 rispettivamente): la funzione è continua su tutto R\mathbb{R}.

Grafico di ff: il tratto lineare x+2x+2 per x1x\le -1, l’arco di parabola x2x^2 per 1<x<2-1<x<2 e la costante 44 per x2x\ge 2 si raccordano senza salti.

Collegamenti

Argomenti: Funzioni proprieta
Concetti: Continuita · Funzione definita a tratti
Competenze: Tracciare grafico

To draw a piecewise function you plot each piece only on its own interval, paying attention to the junction points.

Example — Construction

f(x)={x+2x1x21<x<24x2f(x)=\begin{cases} x+2 & x\le -1 \\ x^2 & -1<x<2 \\ 4 & x\ge 2\end{cases} Domain: all of R\mathbb{R} (the three pieces cover (,1](1,2)[2,+)=R(-\infty,-1]\cup(-1,2)\cup[2,+\infty)=\mathbb{R}). Pieces: line, parabola, constant. At the junction points x=1x=-1 and x=2x=2 the pieces have the same height (11 and 44 respectively): the function is continuous on all of R\mathbb{R}.

Graph of ff: the linear piece x+2x+2 for x1x\le -1, the arc of parabola x2x^2 for 1<x<2-1<x<2 and the constant 44 for x2x\ge 2 join up without jumps.

Topics: Functions and properties
Concepts: Continuity · Piecewise function
Skills: Plotting a graph

Sui tratti aperti IkI_k la funzione eredita la continuità della formula fkf_k. Nei punti di raccordo tra due tratti vicini bisogna controllare a mano che i due valori coincidano: se nel punto x0x_0 di confine tra IkI_k e Ik+1I_{k+1} si ha

limxx0fk(x)=f(x0)=limxx0+fk+1(x),\lim_{x\to x_0^-}f_k(x) = f(x_0) = \lim_{x\to x_0^+}f_{k+1}(x),

la funzione è continua in x0x_0; altrimenti presenta un salto.

Esempio — Determinare un parametro per avere continuità

f(x)={2x+ax1x2x>1f(x)=\begin{cases} 2x+a & x\le 1 \\ x^2 & x>1\end{cases}. Per quale aa la funzione è continua in x=1x=1?

A sinistra limx1(2x+a)=2+a\lim_{x\to 1^-}(2x+a)=2+a; a destra limx1+x2=1\lim_{x\to 1^+}x^2=1; continuità     2+a=1    a=1\iff 2+a=1\iff \boxed{a=-1}.

Esempio — Intersezione con una retta

Trovare i punti di f(x)={x+1x<0x2x0f(x)=\begin{cases} -x+1 & x<0 \\ x^2 & x\ge 0\end{cases} che soddisfano y=1y=1.

Su x<0x<0: x+1=1    x=0-x+1=1 \iff x=0, fuori intervallo \to scartato. Su x0x\ge 0: x2=1    x=1x^2=1 \iff x=1 (x=1x=-1 fuori). Punto (1,1)(1,1).

Inoltre il tratto x<0x<0 ha limite a destra in 00: limx0(x+1)=1\lim_{x\to 0^-}(-x+1)=1 — il valore 11 è “avvicinato” da sinistra senza essere raggiunto. Importante leggere il dominio del tratto.

Collegamenti

Argomenti: Funzioni proprieta
Concetti: Continuita · Funzione definita a tratti
Competenze: Ragionare per casi · Risolvere equazioni

On the open pieces IkI_k the function inherits the continuity of the formula fkf_k. At the junction points between two neighbouring pieces you must check by hand that the two values coincide: if at the boundary point x0x_0 between IkI_k and Ik+1I_{k+1} we have

limxx0fk(x)=f(x0)=limxx0+fk+1(x),\lim_{x\to x_0^-}f_k(x) = f(x_0) = \lim_{x\to x_0^+}f_{k+1}(x),

the function is continuous at x0x_0; otherwise it has a jump.

Example — Finding a parameter to obtain continuity

f(x)={2x+ax1x2x>1f(x)=\begin{cases} 2x+a & x\le 1 \\ x^2 & x>1\end{cases}. For which aa is the function continuous at x=1x=1?

On the left limx1(2x+a)=2+a\lim_{x\to 1^-}(2x+a)=2+a; on the right limx1+x2=1\lim_{x\to 1^+}x^2=1; continuity     2+a=1    a=1\iff 2+a=1\iff \boxed{a=-1}.

Example — Intersection with a line

Find the points of f(x)={x+1x<0x2x0f(x)=\begin{cases} -x+1 & x<0 \\ x^2 & x\ge 0\end{cases} that satisfy y=1y=1.

On x<0x<0: x+1=1    x=0-x+1=1 \iff x=0, outside the interval \to discarded. On x0x\ge 0: x2=1    x=1x^2=1 \iff x=1 (x=1x=-1 outside). Point (1,1)(1,1).

Moreover the piece x<0x<0 has a right-hand limit at 00: limx0(x+1)=1\lim_{x\to 0^-}(-x+1)=1 — the value 11 is “approached” from the left without being reached. It is important to read the domain of the piece.

Topics: Functions and properties
Concepts: Continuity · Piecewise function
Skills: Reasoning by cases · Solving equations

Le funzioni a tratti sono comode per scrivere modelli reali con regole differenti su intervalli diversi: tariffe a scaglioni, deformazione di un materiale prima e dopo il limite elastico, costo di un’utenza con franchigia. Risolvere un’equazione f(x)=kf(x)=k o una disequazione f(x)kf(x)\lessgtr k si fa pezzo per pezzo, controllando alla fine la compatibilità con l’intervallo di ciascun tratto.

Esempio — Tariffa a scaglioni

Una compagnia telefonica fattura: 0,100{,}10 €/min per i primi 100100 minuti del mese, 0,050{,}05 €/min oltre. Costo totale in funzione dei minuti mm: C(m)={0,10m0m100,10+0,05(m100)m>100.C(m)=\begin{cases} 0{,}10\,m & 0\le m\le 100, \\ 10 + 0{,}05(m-100) & m>100.\end{cases} Per quanti minuti si paga C=15C=15 euro? Su 0m1000\le m\le 100: 0,10m=15    m=1500{,}10\,m=15 \iff m=150, fuori intervallo. Su m>100m>100: 10+0,05(m100)=15    m100=100    m=20010+0{,}05(m-100)=15 \iff m-100=100 \iff m=200. Soluzione: m=200\boxed{m=200} minuti.

Collegamenti

Argomenti: Funzioni proprieta
Concetti: Funzione definita a tratti
Competenze: Modellizzare · Risolvere equazioni
Tipo di esercizio: Problema modellizzazione

Piecewise functions are handy for writing real-world models with different rules on different intervals: tiered tariffs, deformation of a material before and after the elastic limit, the cost of a utility with a free allowance. Solving an equation f(x)=kf(x)=k or an inequality f(x)kf(x)\lessgtr k is done piece by piece, checking at the end the compatibility with the interval of each piece.

Example — Tiered tariff

A telephone company charges: 0,100{,}10 €/min for the first 100100 minutes of the month, 0,050{,}05 €/min beyond that. Total cost as a function of the minutes mm: C(m)={0,10m0m100,10+0,05(m100)m>100.C(m)=\begin{cases} 0{,}10\,m & 0\le m\le 100, \\ 10 + 0{,}05(m-100) & m>100.\end{cases} For how many minutes does one pay C=15C=15 euros? On 0m1000\le m\le 100: 0,10m=15    m=1500{,}10\,m=15 \iff m=150, outside the interval. On m>100m>100: 10+0,05(m100)=15    m100=100    m=20010+0{,}05(m-100)=15 \iff m-100=100 \iff m=200. Solution: m=200\boxed{m=200} minutes.

Topics: Functions and properties
Concepts: Piecewise function
Skills: Modelling · Solving equations
Exercise types: Modelling problem