# If a function is both upper and lower semicontinuous, does it have to be continuous?

I am looking for an example of a function which is both upper and lower semi continuous but is not continuous. I have an example: $$f(x):=\begin{cases} 1 & \mathrm{if}\; x < 1,\\[7pt] 2 & \mathrm{if}\; x = 1,\\[7pt] \frac{1}{2} & \mathrm{if}\; x > 1. \end{cases}$$ Am I correct ?

• No. Such a function does not exist. – user61527 Jul 28 '14 at 15:45
• could you please format the question in a better way? – user126154 Jul 28 '14 at 15:45
• What is the nature of the function that I have defined ? – creative Jul 28 '14 at 15:47
• I'm not able to just read your function, please, format it properly – user126154 Jul 28 '14 at 15:48
• Sorry brothers/sisters, I am just trying to understand these concepts. I have given a try and only then I have asked, just to know whether I am right or wrong. Thank You Dear brothers/sisters for helping me out. I dont know how to use latex, for that reason I could not format the question properly. I will learn it soon. Thanx. – creative Jul 28 '14 at 16:01

The function you defined is upper semicontinuous but not lower semicontinuous at $x=1$.