Why is the difference of two sigmoid/tanh functions like a bowl but the addition is monotonic?

194 Views Asked by At

I am trying to plot two functions -

1. Z = sigmoid(sigmoid(x+y-1.5) - sigmoid(x+y-0.5) - 1.5)
2. Z = tanh(tanh(x+y-1.5) - tanh(x+y-0.5) - 1.5)

The images for sigmoid function is as follows:-
1a. Z = sigmoid(x+y-1.5)
sigmoid(x+y-1.5)
1b. Z = sigmoid(x+y-0.5)
sigmoid(x+y-0.5)
1c. Z = sigmoid(sigmoid(x+y-1.5) + sigmoid(x+y-0.5) - 1.5)
sigmoid(sigmoid(x+y-1.5) + sigmoid(x+y-0.5) - 1.5)
1d. Z = sigmoid(sigmoid(x+y-1.5) - sigmoid(x+y-0.5) - 1.5)
Z = sigmoid(sigmoid(x+y-1.5) - sigmoid(x+y-0.5) - 1.5)

Same story is holding even for tanh.

What is confusing me is that while the constituent functions and there sum are monotonically increasing functions, the functions in the questions are bowl shaped. It has been my understanding that sum/difference of two monotonically decreasing functions is also monotonic but this is not the case here. Can you please help me understand this?

1

There are 1 best solutions below

0
On

Sum is ok but not the difference always for monotonicity as also commented by MPW.

Differentiating their difference, derivative may or may not be monotonous but can have one or two or more extrema. It all depends on the difference of individual rates.

For the difference of two increasing functions

$$ \tan^{-1}x -\tan^{-1}(x+1)$$

two extrema are seen in this plot.