# Cardinality of a subset of real functions

Homework Statement .
Let $f:ℝ→ℝ$ such that f is piecewise linear, which means, for every $x \in ℝ$, there is an $ε>0$ such that f restricted to $[x-ε,x]$ and restricted to $[x,x+ε]$ are linear functions. Find the cardinality of $A$={$f:ℝ→ℝ$ / $f$ is piecewise linear}

The attempt at a solution.

I couldn't get further than: $|A|$≤|{$f:ℝ→ℝ$}=$c^c$ but this doesn't get me anywhere. I know that not all linear piecewise functions are continuous, so I cannot assume that $|A|≤c$. I'm trying to think of a bijective function between A and another set which I know the cardinality of. Maybe the set A is a subset of something with cardinality c, but I'm not sure. If this was true, then I could find an injective function from a set B of cardinality c to A to conclude $c=|B|≤|A|≤c$ $→$ $|A|$=$c$.

Related Calculus and Beyond Homework Help News on Phys.org
haruspex
Homework Helper
Gold Member
Think how you would specify such a function. What is the cardinality of the linear sections? What parameters are needed to specify the function over one such section?

• 1 person
verty
Homework Helper
I think all piecewise linear functions are continuous. Choose the smaller ε, then in that open ball, the limit from both sides equals f(x).

• 1 person
HallsofIvy
Homework Helper
No, there exist piece wise linear functions that are NOT continuous. An example is f(x)= -1 if x< 0, 1 if x>= 0.

• 1 person
According to the definition given in the OP, all piecewise linear functions are continuous and the example f(x)= -1 if x< 0, 1 if x>= 0 is not piecewise linear since there is no ε>0 such that f restricted to [−ε,0] is linear.

Though to be fair, I would characterize the definition given in the OP as being nonstandard.

• 1 person
haruspex
Homework Helper
Gold Member
According to the definition given in the OP, all piecewise linear functions are continuous and the example f(x)= -1 if x< 0, 1 if x>= 0 is not piecewise linear since there is no ε>0 such that f restricted to [−ε,0] is linear.

Though to be fair, I would characterize the definition given in the OP as being nonstandard.
Yes, I would have expected the definition to be that either f restricted to $[x-ε,x]$ or f restricted to $[x,x+ε]$ is a linear function. But I think it makes no difference to the answer to the question.

• 1 person
I've convinced myself that by the way "piecewise linear function" is defined in this particular exercise, the function has to be continuous. I'm not so sure how to prove it but I'll try to explain what I've thought: the function is union of line segments (a linear function in $ℝ$ is of the form $f(x)$=$mx+p$. If the function is not continuous, then the discontinuity is between two different line segments. Suppose that from $[x_0,x_1]$ the function is a line segment of the form $l_1=ax+b$ and that in $(x_1,x_2]$ the function is defined as another line segment $l_2=cx+d$ with $l_1$$≠$$l_2$. This being the case, I think we would have the problem that f is not piecewise linear. I mean, if we take the interval $[x_1,x_1+ε]$ (suppose $2x_1+ε≤x_2$) , then $f(x_1+(x_1+ε))$=$f(2x_1+ε)$=$c(2x_1+ε)+d$ and $f(x_1)$+$f(x_1+ε)$=$ax_1+b+c(x_1+ε)+d$, and clearly, is not always true that $c(2x_1+ε)+d$= $ax_1+b+c(x_1+ε)+d$. But then we have that f restricted to $[x_1,x_1+ε]$$f(x+y)$≠$f(x)+f(y)$

If my idea was correct, we have that the set A is a subset of all continuous functions, so $|A|$≤$c$.

I'll try to prove that $c$≤$|A|$. To do this, I have to choose conveniently a set $c$ in order to define an injective function from that set to the set A. So I consider the set $\{0,1\}^{\mathbb N}$ and define $h:\{0,1\}^{\mathbb N}→A$ as follows

$h((a_n)$=$f \in A$ such that $f(n)$=$1$ if $a_n=1$ and $f(n)=0$ if $a_n=0$, on the set $ℝ_{<0}$ I define f to be constantly 0 and on $A\setminus (ℝ_{<0} \cup \mathbb N)$ is extended linearly (I'm not so sure how to write this clearly). Then $f$ is piecewise linear and it's easy to check for injectivity of $h$. It follows that $c$=$|\{0,1\}^{\mathbb N}|$$≤$$|A|≤c$→$|A|=c$

Is this correct?

Dick
Homework Helper
I'll try to prove that $c$≤$|A|$. To do this, I have to choose conveniently a set $c$ in order to define an injective function from that set to the set A. So I consider the set $\{0,1\}^{\mathbb N}$ and define $h:\{0,1\}^{\mathbb N}→A$ as follows

$h((a_n)$=$f \in A$ such that $f(n)$=$1$ if $a_n=1$ and $f(n)=0$ if $a_n=0$, on the set $ℝ_{<0}$ I define f to be constantly 0 and on $A\setminus (ℝ_{<0} \cup \mathbb N)$ is extended linearly (I'm not so sure how to write this clearly). Then $f$ is piecewise linear and it's easy to check for injectivity of $h$. It follows that $c$=$|\{0,1\}^{\mathbb N}|$$≤$$|A|≤c$→$|A|=c$

Is this correct?
I think you are fussing about nothing. If you believe that your set A is defined as a subset of the continuous functions, hence |A|<=c, then to show that |A|=c all you have to do is find a subset B of A such that |B|=c. Isn't that pretty easy? How about f(x)=a for a in R?

Last edited:
• 1 person
I think you are fussing about nothing. If you believe that your set A is defined as a subset of the continuous functions, hence |A|<=c, then to show that |A|=c all you have to do is find a subset B of A such that |B|=c. Isn't that pretty easy? How about f(x)=a for a in R?
I agree, I take a in R and I send it to the constant function f(x)=a for all x in R. This function is much simpler and it's immediate to check for injectivity.