# Confusion regarding the convexity of a function

I want to know how come the function f(y)=1/y is convex?

-

How do you understand the word 'convex'? Aka what is your definition of a convex function? – Calvin Lin Jan 9 at 23:58
@CalvinLin The function is convex only if y > 0 if y < 0 it is concave. So how can we say it is convex – user34790 Jan 10 at 0:01
@user34790 The function is not convex over the entire $\mathbb{R}$. However, probably in your setting, you are studying the function for $y>0$ only and hence it is convex. – user17762 Jan 10 at 0:11
@user34790 Great! (I think you mean $y''>0$) I'm glad you pointed that out the 2 different regions. When people define functions, they also talk about the domain of the function. In this case, you will have to look at the domain, which as Marvis pointed out. – Calvin Lin Jan 10 at 15:32

## 1 Answer

One way to check convexity is to check if the second derivative, if it exists, is positive. It is easy to check that the second derivative is positive for $y>0$ in your case.

We have $f(y) = \dfrac1y$. Hence, $f'(y) = -\dfrac1{y^2}$, $f''(y) = \dfrac2{y^3} > 0$, for $y>0$.

Hence, the function is convex for $y>0$ and concave for $y<0$.

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 10, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9187220335006714, "perplexity_flag": "head"}