Defining a function with certain properties

243 Views Asked by At

I'm a bit rusty in mathematics so I need your help please :)

I need a function $y$ that satisfies: $$\begin{align*} y &= ax\\ y &= \left\{\begin{array}{ll} x &\text{if }x\geq 0;\\ 0 &\text{if }x\lt 0. \end{array}\right. \end{align*}$$

Is there a way to do this? What should $a$ be like? I believe I need something that is $1$ for positive value and $0$ for negative.

Thank you

3

There are 3 best solutions below

1
On

You can certainly define a function as $\begin {cases} y=ax \text{ if } x\ge 0 \\ y=0 \text{ if } x \lt 0 \end {cases}$. It follows the negative $x$ axis from the left to the origin, then slopes up at slope $a$ and you can choose $a$ to fit your needs (like $1$). I don't know any simpler way to express it.

0
On

What you have written is already a function. A function is anything such that, when given an input, to specifies exactly one output - there is no requirement that a function be given by a "formula" in terms of the input. For example, here is a function that takes in real numbers and outputs real numbers: $$f(x)=\begin{cases}2x\text{ if }x>2\\5\text{ if }x=2\\(-1)^{\lfloor x\rfloor}\text{ if }0<x<2\\ \pi\cdot e^x\text{ if }x<0\end{cases}$$ It has no nice "formula" in terms of $x$, but it is still a function.

However, if you want something to write in place of $a$ to make the formula $y=a\cdot x$ do what you want, you can use the Iverson bracket, specifically $$[x\geq0]=\begin{cases}1\text{ if }x\geq 0\\0\text{ if }x<0\end{cases}$$

1
On

It is not absolutely clear what is asked for. But maybe what is wanted is $$y=(x + |x|)/2$$