```markdown
### Composition with Scalar Functions

**Composition of \( g : \mathbb{R}^n \to \mathbb{R} \) and \( h : \mathbb{R} \to \mathbb{R} \):**

\[ f(x) = h(g(x)) \]

**\( f \) is convex if:**
- \( g \) is convex, \( h \) is convex, \( \tilde{h} \) is nondecreasing
- \( g \) is concave, \( h \) is convex, \( \tilde{h} \) is nonincreasing

**Proof (for \( n = 1 \), differentiable \( g, h \)):**

\[ f''(x) = h''(g(x))g'(x)^2 + h'(g(x))g''(x) \]

**Note:** Monotonicity must hold for extended-value extension \( \tilde{h} \).

**Examples:**
- \( \exp g(x) \) is convex if \( g \) is convex.
- \( 1/g(x) \) is convex if \( g \) is concave and positive.

*Source: A. d'Aspremont. Convex Optimization M2. Slide 19/67*
```