Semouey, I am not sure you answered Paze's question, which is whether

reaches 1 and -1 on the segment 1 ≤ x ≤ 365. As Paze correctly notes, sin(x/2) is defined on all real numbers and reaches 1 and -1, but when x is restricted to [0, 1] or even [0, 2π], sin(x/2) does not reach -1.

In fact, h(x) does take on 1 and -1 between x = 1 and x = 365. Nobody said that h(1) = -0.98 is the minimum.

No, h(1) is not the minimum. If the function is designed correctly, the minimum is reached around December 22, not on January 1.

If we restrict the domain so that its length (365) is less than the period (366), this

**may** mean that not all values from the complete image (i.e., values taken by the function for all real arguments) are taken when the argument is in the restricted domain. As has beed said, sin(x/2) ≥ 0 for 0 ≤ x ≤ 2π, so negative values are not taken. However, one can see from the graph that h(x) still takes all values between -1 and 1 when 100 ≤ x ≤ 365.

This is answered by the following statement.

Theorem. Suppose

is a function with a persiod T, i.e., h(x + T) = h(x) for all x. Let I be the image of h(x), i.e.,

. For any number x

_{0}, denote D = [x

_{0}, x

_{0} + T). Let h' be h restricted to D. Then h' : D → I is a surjection, i.e., h'(x) accepts every value in I for some x ∈ D.

Proof. Fix an arbitrary y ∈ I assumed at some x, i.e., h(x) = y. We need to find an x' ∈ D such that h'(x') = h(x') = y. Of course, if x ∈ D, then we can take x' = x and we are done. Suppose that x is located to the right of D, i.e., x ≥ x

_{0} + T. Then we can repeatedly subtract T from x without changing the value of h and we will eventually reach a point x' inside D. We cannot "overshoot" D because the length of D, i.e., T, equals the step we are using to move left. More precisely, the number of steps we need to make is

, where

is the

floor function, and x' = x - nT. Since h is periodic, h(x') = h(x). The fact that n ≤ (x - x

_{0}) / T < n + 1, which is the defining property of the floor function, implies that x

_{0} ≤ x - nT < T + x

_{0}, i.e., x' ∈ D. The case when x lies to the left of D is considered similarly. (End of proof.)

The longest day is achieved for x such that 2π(x - 82) / 365 = π / 2, i.e., x = 365 / 4 + 82 = 173.25. Similarly, the shortest day is when 2π(x - 82) / 365 = 3π / 2, i.e., x = 3 * 365 / 4 + 82 = 355.75, which is around December 22.

A couple of remarks. We need to be careful with the boundary values of x. The length of the segment 1 ≤ x ≤ 365 is 364, which is less than the period, and so the value of the function at x = 1 and x = 365 is not exactly the same. The function should be considered either on [0, 365) or [1, 366). Second, the word "

amplitude" is ambiguous. There is "peak-to-peak amplitude", which is 2 for sin(x), and simply "peak amplitude", which is 1 for sin(x).