Explanation:
Okay, so I need to find the maximum value of the expression |1 + z| + |1 - z + z²| where z is a complex number with |z| = 1. Hmm, let me think about how to approach this.

First, since |z| = 1, z lies on the unit circle in the complex plane. That means I can represent z as e^(iθ) where θ is the argument of z. So maybe I can write z = e^(iθ) and then express both |1 + z| and |1 - z + z²| in terms of θ. Then, I can try to maximize the sum of these two absolute values.

Let me start by writing down z = e^(iθ). Then:

First term: |1 + z| = |1 + e^(iθ)|.

I remember that |1 + e^(iθ)| can be simplified. Let me recall the formula for the modulus of a complex number. If I have a complex number in the form a + ib, its modulus is √(a² + b²). Alternatively, for |1 + e^(iθ)|, using Euler's formula, e^(iθ) = cosθ + i sinθ. So adding 1 gives 1 + cosθ + i sinθ.

Then |1 + e^(iθ)| = √[(1 + cosθ)² + (sinθ)²]. Let me compute that:

(1 + cosθ)² + (sinθ)² = 1 + 2cosθ + cos²θ + sin²θ. Since cos²θ + sin²θ = 1, this becomes 1 + 2cosθ + 1 = 2 + 2cosθ. Therefore, |1 + e^(iθ)| = √(2 + 2cosθ) = √[2(1 + cosθ)].

Alternatively, using the identity 1 + cosθ = 2cos²(θ/2), so this becomes √[2 * 2cos²(θ/2)] = √[4cos²(θ/2)] = 2|cos(θ/2)|. Since θ is an angle, cos(θ/2) can be positive or negative, but modulus is non-negative. However, since we are dealing with modulus, maybe we can write it as 2|cos(θ/2)|. However, since θ is an angle parameterizing the unit circle, θ can range from 0 to 2π. Therefore, θ/2 ranges from 0 to π, so cos(θ/2) can be positive or negative. Wait, but cos(θ/2) is positive when θ/2 is between -π/2 to π/2, but θ is between 0 and 2π, so θ/2 is between 0 and π. So cos(θ/2) is positive when θ is between 0 and π, and negative when θ is between π and 2π. Therefore, |cos(θ/2)| is cos(θ/2) when θ ∈ [0, π], and -cos(θ/2) when θ ∈ [π, 2π].

But maybe there's another way to write |1 + z|. Alternatively, using complex numbers, |1 + z| is the distance from -1 to z on the complex plane. Since z is on the unit circle, the distance from -1 to z is 2|cos(θ/2)|, as we derived earlier.

But maybe instead of getting bogged down here, I can note that |1 + z| = 2|cos(θ/2)|. So that simplifies the first term.

Now moving on to the second term: |1 - z + z²|. Let me try to simplify this expression. Maybe I can factor or rewrite it in terms of z. Let me see:

Let me write down the expression: 1 - z + z². Let me consider z² - z + 1. Hmm, is there a way to factor this quadratic? Let me check the discriminant. For a quadratic equation z² - z + 1 = 0, discriminant D = (-1)^2 - 4*1*1 = 1 - 4 = -3. So it doesn't factor over real numbers, but since we're dealing with complex numbers, perhaps we can write it as something else? Alternatively, maybe I can express this in terms of z³?

Alternatively, since z is on the unit circle, |z| = 1, so z̄ = 1/z. Maybe that could be helpful? Let me think.

But let me first try to compute |1 - z + z²|. Let me write it as |z² - z + 1|. Let me note that z² - z + 1 is similar to z³ + 1? Wait, z³ - 1 factors as (z - 1)(z² + z + 1). So z² + z + 1 = (z³ - 1)/(z - 1). But our expression is z² - z + 1. Hmm, not quite the same. Let me see:

Alternatively, perhaps I can relate it to z³? Let me compute z³ - 1 = (z - 1)(z² + z + 1). So if we have z² - z + 1, that's similar but different. Maybe if I manipulate:

z² - z + 1 = z² + z + 1 - 2z = (z² + z + 1) - 2z. But not sure if that helps. Alternatively, maybe consider multiplying by z?

Wait, but maybe instead of trying to factor, I can compute its modulus directly. Let me write z = e^(iθ) again, so z² = e^(i2θ). Then:

1 - z + z² = 1 - e^(iθ) + e^(i2θ). Let me write this in terms of sine and cosine:

1 - cosθ - i sinθ + cos2θ + i sin2θ. Then combining real and imaginary parts:

Real part: 1 - cosθ + cos2θ

Imaginary part: -sinθ + sin2θ

Therefore, modulus squared is [1 - cosθ + cos2θ]^2 + [-sinθ + sin2θ]^2. Let me compute this expression. Maybe simplifying step by step.

First, let me compute 1 - cosθ + cos2θ. Let me recall that cos2θ = 2cos²θ - 1, so substituting:

1 - cosθ + 2cos²θ - 1 = -cosθ + 2cos²θ = 2cos²θ - cosθ.

Similarly, the imaginary part: -sinθ + sin2θ. And sin2θ = 2sinθcosθ. So this becomes -sinθ + 2sinθcosθ = sinθ(-1 + 2cosθ).

So modulus squared is [2cos²θ - cosθ]^2 + [sinθ(-1 + 2cosθ)]^2.

Let me factor out (-1 + 2cosθ) from both terms? Wait, notice that 2cos²θ - cosθ can be written as cosθ(2cosθ - 1). Similarly, the other term is sinθ(-1 + 2cosθ) = sinθ(2cosθ - 1). Therefore, modulus squared becomes [cosθ(2cosθ - 1)]² + [sinθ(2cosθ - 1)]² = (2cosθ - 1)² [cos²θ + sin²θ] = (2cosθ - 1)² * 1 = (2cosθ - 1)^2.

Wow, that's nice! Therefore, |1 - z + z²| = sqrt[(2cosθ - 1)^2] = |2cosθ - 1|.

So that simplifies the second term! Therefore, the original expression becomes |1 + z| + |1 - z + z²| = 2|cos(θ/2)| + |2cosθ - 1|.

So now, the problem reduces to finding the maximum value of 2|cos(θ/2)| + |2cosθ - 1| where θ ∈ [0, 2π).

Okay, so now I need to analyze the function f(θ) = 2|cos(θ/2)| + |2cosθ - 1|.

This seems more manageable. Let me note that θ is in [0, 2π), so θ/2 is in [0, π). Therefore, cos(θ/2) is non-negative when θ ∈ [0, π] and non-positive when θ ∈ [π, 2π). Therefore, |cos(θ/2)| = cos(θ/2) for θ ∈ [0, π], and |cos(θ/2)| = -cos(θ/2) for θ ∈ [π, 2π).

Therefore, we can split the analysis into two intervals: θ ∈ [0, π] and θ ∈ [π, 2π). However, perhaps there is some symmetry. Let me check.

Alternatively, since cosθ is symmetric around θ = π, maybe we can consider θ ∈ [0, π] and then double-check if the maximum occurs there or elsewhere. But let me proceed step by step.

First, let me consider θ ∈ [0, π]. In this case, |cos(θ/2)| = cos(θ/2), so f(θ) = 2cos(θ/2) + |2cosθ - 1|.

Similarly, for θ ∈ [π, 2π], |cos(θ/2)| = -cos(θ/2) (since θ/2 ∈ [π/2, π), so cos(θ/2) ≤ 0), so f(θ) = -2cos(θ/2) + |2cosθ - 1|.

But before going further, perhaps I can make substitution variables to simplify. Let me consider x = θ. Alternatively, let me set φ = θ/2. Since θ ∈ [0, π], then φ ∈ [0, π/2], and for θ ∈ [π, 2π], φ ∈ [π/2, π]. Let me check:

If θ ∈ [0, π], then φ = θ/2 ∈ [0, π/2]. Then cosφ is non-negative, so |cosφ| = cosφ. For θ ∈ [π, 2π], φ ∈ [π/2, π], and cosφ is non-positive, so |cosφ| = -cosφ.

But maybe this substitution can help. Let me see.

Alternatively, since cosθ can be expressed in terms of cosφ. Let me note that θ = 2φ. Therefore, cosθ = cos(2φ) = 2cos²φ - 1. Therefore, in terms of φ, the expression becomes:

For θ ∈ [0, π] (φ ∈ [0, π/2]):

f(θ) = 2cosφ + |2cosθ - 1| = 2cosφ + |2*(2cos²φ - 1) - 1| = 2cosφ + |4cos²φ - 2 - 1| = 2cosφ + |4cos²φ - 3|.

Similarly, for θ ∈ [π, 2π] (φ ∈ [π/2, π]):

f(θ) = -2cosφ + |2cosθ - 1| = -2cosφ + |2*(2cos²φ - 1) - 1| = -2cosφ + |4cos²φ - 3|.

Therefore, in both cases, the function becomes:

For φ ∈ [0, π/2], f(φ) = 2cosφ + |4cos²φ - 3|,

and for φ ∈ [π/2, π], f(φ) = -2cosφ + |4cos²φ - 3|.

Wait, but maybe we can analyze the entire function over φ ∈ [0, π], considering the absolute value. Let me note that 4cos²φ - 3 is inside the absolute value. Let me denote y = cosφ. Then, since φ ∈ [0, π], y ∈ [-1, 1]. However, for φ ∈ [0, π/2], y ∈ [0, 1], and for φ ∈ [π/2, π], y ∈ [-1, 0].

Therefore, for φ ∈ [0, π/2], y ∈ [0, 1], and 4y² - 3 is in [4*(0)^2 - 3, 4*(1)^2 - 3] = [-3, 1]. Therefore, |4y² - 3| is equal to 4y² - 3 when 4y² - 3 ≥ 0, i.e., when y² ≥ 3/4, so |y| ≥ √(3)/2. Since y ∈ [0, 1], this corresponds to y ≥ √(3)/2 ≈ 0.866.

Similarly, when y < √(3)/2, |4y² - 3| = 3 - 4y².

Similarly, for φ ∈ [π/2, π], y ∈ [-1, 0], so 4y² - 3 is still in [-3, 1], so same as before. However, since y is negative, but squared, so same as for the positive case. Therefore, the absolute value expression is still 4y² - 3 when |y| ≥ √(3)/2, and 3 - 4y² otherwise.

Therefore, we can split the analysis into cases where 4y² - 3 is positive or negative. Let me proceed.

Let me first consider φ ∈ [0, π/2], i.e., y ∈ [0, 1].

Case 1: y ∈ [0, √3/2]. Then |4y² - 3| = 3 - 4y². Therefore, f(φ) = 2y + 3 - 4y².

Case 2: y ∈ [√3/2, 1]. Then |4y² - 3| = 4y² - 3. Therefore, f(φ) = 2y + 4y² - 3.

Similarly, for φ ∈ [π/2, π], y ∈ [-1, 0]. Let me note that since we have |4y² - 3| again, same as above, but f(φ) = -2y + |4y² - 3|. However, since y is negative, -2y is positive. Let me check:

Original expression for φ ∈ [π/2, π]: f(φ) = -2cosφ + |4cos²φ - 3| = -2y + |4y² - 3|.

But since y ∈ [-1, 0], let me denote y = -k, where k ∈ [0, 1]. Then f(φ) becomes -2(-k) + |4(-k)^2 - 3| = 2k + |4k² - 3|. Which is same as the expression for φ ∈ [0, π/2], with variable substitution. Therefore, the function for φ ∈ [π/2, π] is symmetric to that of φ ∈ [0, π/2]. Therefore, the maximum over φ ∈ [π/2, π] would be same as the maximum over φ ∈ [0, π/2], but mirrored. Therefore, maybe we can focus on φ ∈ [0, π/2] and analyze there, then the maximum will also be achieved in φ ∈ [π/2, π], but perhaps same value. Therefore, perhaps I can consider the entire interval φ ∈ [0, π], but with y ∈ [-1, 1].

But maybe to be thorough, let me proceed step by step.

First, let's analyze φ ∈ [0, π/2], which corresponds to θ ∈ [0, π], and then φ ∈ [π/2, π] corresponds to θ ∈ [π, 2π].

Let me first handle φ ∈ [0, π/2]. Let me consider Case 1 and Case 2.

Case 1: y ∈ [0, √3/2]. Then f(φ) = 2y + 3 - 4y². Let me denote this as f1(y) = -4y² + 2y + 3.

This is a quadratic function in y, opening downward (coefficient -4). Its maximum occurs at vertex. The vertex of a quadratic ax² + bx + c is at -b/(2a). So here, a = -4, b = 2. Therefore, vertex at y = -2/(2*(-4)) = -2 / (-8) = 1/4.

But since in this case, y ∈ [0, √3/2 ≈ 0.866]. Therefore, the maximum of f1(y) in this interval occurs either at y = 1/4 or at the endpoints. Let me check f1 at y = 0, y = √3/2, and y = 1/4.

First, f1(0) = -0 + 0 + 3 = 3.

f1(√3/2) = -4*( (√3/2)^2 ) + 2*(√3/2) + 3 = -4*(3/4) + √3 + 3 = -3 + √3 + 3 = √3 ≈ 1.732.

f1(1/4) = -4*(1/4)^2 + 2*(1/4) + 3 = -4*(1/16) + 1/2 + 3 = -1/4 + 1/2 + 3 = 1/4 + 3 = 3.25.

So the maximum in Case 1 is 3.25 at y = 1/4.

Case 2: y ∈ [√3/2, 1]. Then f(φ) = 2y + 4y² - 3. Let me denote this as f2(y) = 4y² + 2y - 3. This is a quadratic in y, opening upwards (a = 4). Therefore, its minimum is at vertex, and maximum would be at endpoints of the interval.

Compute f2 at y = √3/2 and y = 1.

First, f2(√3/2) = 4*( (√3/2)^2 ) + 2*(√3/2) - 3 = 4*(3/4) + √3 - 3 = 3 + √3 - 3 = √3 ≈ 1.732.

f2(1) = 4*(1)^2 + 2*1 - 3 = 4 + 2 - 3 = 3.

Therefore, the maximum in Case 2 is 3 at y = 1.

Therefore, for φ ∈ [0, π/2], the maximum of f(φ) is 3.25 (which is 13/4) at y = 1/4.

Now, moving to φ ∈ [π/2, π]. As mentioned earlier, since this interval corresponds to y ∈ [-1, 0], and the function becomes 2k + |4k² - 3| where k = -y ∈ [0, 1]. Therefore, this is same as the Case 1 and Case 2 for k ∈ [0, 1]. Therefore, the maximum in this interval would also be 13/4.

Therefore, overall, the maximum of the function f(θ) is 13/4? Wait, but let me check whether this is correct. Wait, 13/4 is 3.25, which is larger than the maximum in the other cases. However, I need to make sure that there isn't a higher value in other regions. Wait, but since we considered both intervals, and the maxima there are 3.25 and 3. So 3.25 is higher.

Wait, but let me check if there are any other critical points? For example, when considering the absolute value function, sometimes there might be maxima at the points where the expression inside the absolute value is zero.

Wait, the expression |4y² - 3| has a zero when 4y² - 3 = 0 => y² = 3/4 => y = ±√3/2. Therefore, at y = √3/2 and y = -√3/2.

But we already considered these points in our Case 1 and Case 2.

But maybe there are other critical points? For example, when we have different expressions for f(θ) depending on y.

But in our analysis, we considered splitting into cases based on the sign of 4y² - 3. Therefore, we have considered all possibilities.

Therefore, the maximum value of f(θ) is 13/4? Wait, but hold on. Let me check with specific values.

For example, when y = 1/4, which is in Case 1 (since 1/4 < √3/2 ≈ 0.866). Let me compute θ corresponding to y = 1/4. Since y = cosφ = 1/4, φ = arccos(1/4). Therefore, θ = 2φ. Let me compute |1 + z| + |1 - z + z²| in this case.

But maybe instead of going back to θ, I can check whether the value of 13/4 is indeed achievable.

Alternatively, let me verify the calculation of f1(1/4):

f1(y) = -4y² + 2y + 3. If y = 1/4:

-4*(1/4)^2 + 2*(1/4) + 3 = -4*(1/16) + 1/2 + 3 = -1/4 + 1/2 + 3 = 1/4 + 3 = 3.25 = 13/4. Yes.

But let me check if that's indeed the maximum. However, is there a possibility that when considering θ ∈ [π, 2π], there could be a higher value? For example, if we take θ such that cosθ is negative? Let me think.

Wait, when θ ∈ [π, 2π], we had the function f(φ) = -2y + |4y² - 3|, where y = cosφ, φ ∈ [π/2, π], so y ∈ [-1, 0]. If I take y = -1/4, then k = 1/4, and f(φ) becomes 2*(1/4) + |4*(1/4)^2 - 3| = 1/2 + |4*(1/16) - 3| = 1/2 + |1/4 - 3| = 1/2 + | -11/4 | = 1/2 + 11/4 = 13/4. So same value. Therefore, in this case, when y = -1/4, same value.

Therefore, the maximum value is 13/4? Wait, but is there a way to get a higher value?

Wait, let me check another point. For example, when θ = π. Then z = e^(iπ) = -1. Then compute |1 + z| + |1 - z + z²|.

First term: |1 + (-1)| = |0| = 0.

Second term: |1 - (-1) + (-1)^2| = |1 + 1 + 1| = |3| = 3. Therefore, total is 0 + 3 = 3, which is less than 13/4 (which is 3.25).

Another point: θ = 0. Then z = 1. |1 + 1| + |1 - 1 + 1| = |2| + |1| = 2 + 1 = 3. Again, same as above.

What about θ = π/2? Then z = i. Let me compute:

First term: |1 + i| = √(1 + 1) = √2 ≈ 1.414.

Second term: |1 - i + i²| = |1 - i - 1| = | -i | = 1. Therefore total is √2 + 1 ≈ 2.414, less than 3.25.

Another point: Let me take θ where cosθ = -1/4. Let me see. Wait, for φ ∈ [π/2, π], y = cosφ = -1/4, so θ = 2φ. Let me compute φ such that cosφ = -1/4. Then φ = arccos(-1/4), which is in [π/2, π]. Then θ = 2φ. Let me compute |1 + z| + |1 - z + z²| here. Wait, but we already know that in this case, f(θ) is 13/4. Therefore, that is correct.

But let me check with θ = 2φ where φ = arccos(-1/4). Let me compute z = e^(iθ) = e^(i*2φ). But since cosφ = -1/4, sinφ = sqrt(1 - (1/4)^2) = sqrt(15)/4. Therefore, φ is in the second quadrant. Then θ = 2φ. Let me compute cosθ = cos(2φ) = 2cos²φ - 1 = 2*(1/16) - 1 = 1/8 - 1 = -7/8. Therefore, cosθ = -7/8. Then 2cosθ - 1 = 2*(-7/8) - 1 = -14/8 - 8/8 = -22/8 = -11/4. Therefore, |2cosθ - 1| = 11/4. Also, |1 + z| = 2|cos(θ/2)|. Since θ/2 = φ, and cosφ = -1/4, so |cosφ| = 1/4. Therefore, 2*(1/4) = 1/2. Therefore, total expression is 1/2 + 11/4 = 13/4. Yes, that checks out.

So indeed, 13/4 is achievable. Is it the maximum?

Wait, let me check another point. Suppose I take y = 0. Then, for φ ∈ [0, π/2], y = 0. Then f(φ) = 2*0 + |0 - 3| = 0 + 3 = 3. Which is less than 13/4.

What about y approaching √3/2? For example, y = √3/2. Then, in Case 1, f1(y) = √3 ≈ 1.732, which is less than 13/4.

Alternatively, maybe there are maxima where the derivative is zero. Let me check for the Case 1 function where we have f1(y) = -4y² + 2y + 3. We already found that its maximum is at y = 1/4. Similarly for the other cases.

But let me think if there's another way to approach this problem. Maybe using geometry?

Since z is on the unit circle, maybe we can interpret |1 + z| as the distance from z to -1, and |1 - z + z²| as another distance? Wait, but how?

Alternatively, perhaps we can consider writing z² - z + 1 in terms of z. Let me try:

z² - z + 1. But since z is on the unit circle, z̄ = 1/z. Maybe multiplying by z̄:

Wait, not sure. Alternatively, note that z² - z + 1 = z² + 1 - z. Maybe express it in terms of z + 1/z?

Wait, since z is on the unit circle, z + 1/z = 2cosθ. But z² + 1/z² = 2cos2θ. However, here we have z² - z + 1. Maybe not directly helpful.

Alternatively, think of |1 - z + z²|. Let me consider that as |z² - z + 1|. Let me compute this for specific z. For example, when z = e^(iθ). Earlier we found that it's |2cosθ - 1|. Therefore, maybe that's helpful.

So the original expression is 2|cos(θ/2)| + |2cosθ - 1|. So maybe we can parametrize in terms of cosθ. Let me set x = cosθ. Then, since θ ∈ [0, 2π), x ∈ [-1, 1]. Also, cos(θ/2) can be expressed in terms of x. Recall that cos(θ/2) = sqrt[(1 + cosθ)/2] or -sqrt[(1 + cosθ)/2], depending on θ. But since |cos(θ/2)| is always non-negative, we can write |cos(θ/2)| = sqrt[(1 + x)/2]. Wait, let me check:

cos(θ/2) = ±sqrt[(1 + cosθ)/2]. Therefore, |cos(θ/2)| = sqrt[(1 + cosθ)/2].

Therefore, the expression becomes:

sqrt[(1 + x)/2] * 2 + |2x - 1| = 2*sqrt[(1 + x)/2] + |2x - 1| = sqrt(2(1 + x)) + |2x - 1|.

So we can write the function as f(x) = sqrt(2(1 + x)) + |2x - 1| where x ∈ [-1, 1].

This is another way to represent the same function. So now, we can think of f(x) as sqrt(2(1 + x)) + |2x - 1|, with x ∈ [-1, 1].

This seems like a more manageable expression. Let me analyze this function. Let me consider the critical points where the absolute value changes, i.e., when 2x - 1 = 0 => x = 1/2. Therefore, we can split the interval [-1, 1] into two parts: x ∈ [-1, 1/2] and x ∈ [1/2, 1].

For x ∈ [-1, 1/2], 2x - 1 ≤ 0, so |2x - 1| = 1 - 2x. Therefore, f(x) = sqrt(2(1 + x)) + 1 - 2x.

For x ∈ [1/2, 1], |2x - 1| = 2x - 1. Therefore, f(x) = sqrt(2(1 + x)) + 2x - 1.

Therefore, we can analyze these two functions separately.

First, consider x ∈ [-1, 1/2], f(x) = sqrt(2(1 + x)) + 1 - 2x. Let me denote this as f1(x).

To find its maximum, compute derivative.

Let me compute f1'(x):

d/dx [sqrt(2(1 + x))] = (1/(2*sqrt(2(1 + x)))) * 2 = 1/sqrt(2(1 + x)).

Then derivative of 1 - 2x is -2. Therefore, f1'(x) = 1/sqrt(2(1 + x)) - 2.

Set derivative to zero:

1/sqrt(2(1 + x)) - 2 = 0 => 1/sqrt(2(1 + x)) = 2 => sqrt(2(1 + x)) = 1/2 => square both sides: 2(1 + x) = 1/4 => 1 + x = 1/8 => x = 1/8 - 1 = -7/8.

Therefore, critical point at x = -7/8. Now, check if this is in [-1, 1/2]. Yes, since -7/8 ≈ -0.875 is within [-1, 0.5].

Therefore, we need to evaluate f1 at x = -1, x = -7/8, and x = 1/2.

Compute f1(-1): sqrt(2(1 + (-1))) + 1 - 2*(-1) = sqrt(0) + 1 + 2 = 0 + 3 = 3.

Compute f1(-7/8): sqrt(2(1 + (-7/8))) + 1 - 2*(-7/8) = sqrt(2*(1/8)) + 1 + 14/8 = sqrt(1/4) + 1 + 7/4 = 1/2 + 1 + 1.75 = 1/2 + 2.75 = 3.25 = 13/4.

Compute f1(1/2): sqrt(2(1 + 1/2)) + 1 - 2*(1/2) = sqrt(2*(3/2)) + 1 - 1 = sqrt(3) + 0 ≈ 1.732.

Therefore, the maximum on x ∈ [-1, 1/2] is 13/4 at x = -7/8.

Now, consider x ∈ [1/2, 1], f(x) = sqrt(2(1 + x)) + 2x - 1. Let me denote this as f2(x).

Compute derivative f2'(x):

d/dx [sqrt(2(1 + x))] = 1/sqrt(2(1 + x)) as before.

Derivative of 2x - 1 is 2. Therefore, f2'(x) = 1/sqrt(2(1 + x)) + 2.

Since 1/sqrt(2(1 + x)) is always positive (since 1 + x > 0 for x ∈ [1/2,1]), adding 2 makes it always positive. Therefore, f2(x) is strictly increasing on [1/2, 1]. Therefore, its maximum occurs at x = 1.

Compute f2(1): sqrt(2*(1 + 1)) + 2*1 - 1 = sqrt(4) + 2 - 1 = 2 + 1 = 3.

Compute f2(1/2): sqrt(2*(1 + 1/2)) + 2*(1/2) - 1 = sqrt(3) + 1 - 1 = sqrt(3) ≈ 1.732.

Thus, on [1/2, 1], maximum is 3.

Therefore, overall, the maximum of f(x) is 13/4 = 3.25, achieved at x = -7/8. Therefore, the maximum value of the original expression is 13/4.

But let me check if this is correct by verifying with θ corresponding to x = -7/8.

Since x = cosθ = -7/8. Therefore, θ = arccos(-7/8). Then, |1 + z| = 2|cos(θ/2)|. Let me compute cos(θ/2).

Using the identity cos(θ/2) = sqrt[(1 + cosθ)/2] = sqrt[(1 - 7/8)/2] = sqrt[(1/8)/2] = sqrt(1/16) = 1/4. Wait, but θ is in [π, 2π], since cosθ = -7/8 is negative. Therefore, θ ∈ [π/2, 3π/2]? Wait, cosθ is negative in (π/2, 3π/2). But θ is in [0, 2π). However, since x = cosθ = -7/8, θ can be in (π/2, 3π/2). But then θ/2 would be in (π/4, 3π/4). Therefore, cos(θ/2) is positive in (π/4, π/2) and negative in (π/2, 3π/4). Wait, but we have |cos(θ/2)|, which is always non-negative.

But earlier, we derived that |cos(θ/2)| = sqrt[(1 + x)/2]. Since x = -7/8, (1 + x)/2 = (1 - 7/8)/2 = (1/8)/2 = 1/16. Therefore sqrt(1/16) = 1/4. Therefore, |1 + z| = 2*(1/4) = 1/2.

Then, |2x - 1| = |2*(-7/8) - 1| = |-14/8 - 8/8| = |-22/8| = 11/4. Therefore, total expression is 1/2 + 11/4 = 13/4.

Yes, that checks out. Therefore, the maximum value is indeed 13/4.

But just to make sure, let me check if there's any other critical points or if I missed something.

For example, when analyzing f(x) in terms of x, we found that the maximum occurs at x = -7/8, giving 13/4. Since all other intervals have lower maxima, this must be the global maximum.

Alternatively, let me consider another approach. Since z is on the unit circle, maybe we can use triangle inequality or other complex number properties.

But since we already have the answer through multiple methods, and verified with substitution, perhaps it's safe.

But just to confirm, let me consider another value of θ. Let me pick θ such that cosθ = -7/8. Let me compute z = e^(iθ). Then compute |1 + z| + |1 - z + z²| numerically.

Let me compute θ where cosθ = -7/8. Then θ ≈ arccos(-7/8). Let me compute θ in radians.

Let me compute arccos(-7/8). Since cosθ = -7/8, θ is in the second or third quadrant. Let me compute it numerically. Let me use approximate values.

cosθ = -0.875. arccos(-0.875) ≈ 2.63 radians (since π ≈ 3.14, so 2.63 is in the second quadrant).

Compute z = e^(iθ). Then |1 + z| = |1 + e^(iθ)|. As before, which is 2|cos(θ/2)|. θ ≈ 2.63, so θ/2 ≈ 1.315 radians. cos(1.315) ≈ cos(π - 1.827)? Wait, let me compute it numerically. cos(1.315) ≈ cos(1.315). Let me recall that cos(π/2) = 0, cos(π) = -1. π ≈ 3.14, so π/2 ≈ 1.57. Therefore, 1.315 is less than π/2? Wait, no: π/2 ≈ 1.57, so 1.315 is less than that. Wait, θ ≈ 2.63, θ/2 ≈ 1.315, so θ/2 is in first quadrant (since less than π/2)? Wait, π/2 ≈ 1.57, so 1.315 is less than π/2. Therefore, cos(θ/2) is positive. Therefore, |1 + z| = 2cos(θ/2).

Compute cos(θ/2): let me use the identity cos(θ/2) = sqrt[(1 + cosθ)/2] = sqrt[(1 - 7/8)/2] = sqrt[(1/8)/2] = sqrt(1/16) = 1/4. Therefore, |1 + z| = 2*(1/4) = 1/2.

Now compute |1 - z + z²|. Earlier we found that this is |2cosθ - 1|. cosθ = -7/8, so 2cosθ - 1 = 2*(-7/8) - 1 = -14/8 - 8/8 = -22/8 = -11/4. Therefore, absolute value is 11/4.

Therefore, the total is 1/2 + 11/4 = 13/4.

So yes, this confirms again. Therefore, it seems 13/4 is indeed the maximum value.

But let me check once more for another possible maximum. Suppose I consider cases where the absolute value terms could interact more. For example, when both terms are maximized. But since they are dependent on θ, it's not straightforward. However, we have already through calculus found the critical point.

Alternatively, think about geometric interpretations. The first term |1 + z| is the distance from z to -1, and the second term |1 - z + z²|. But how to interpret |1 - z + z²|?

Alternatively, since we found that |1 - z + z²| = |2cosθ - 1|. Therefore, if we think of 2cosθ - 1, which ranges between 2*(-1) -1 = -3 and 2*(1) -1 = 1. Therefore, |2cosθ - 1| ranges between 0 and 3.

But adding it to |1 + z|, which is between 0 and 2 (since |1 + z| = 2|cos(θ/2)|, and cos(θ/2) ranges from -1 to 1, so |cos(θ/2)| from 0 to 1, so 2|cos(θ/2)| from 0 to 2). Therefore, the maximum possible sum could be up to 2 + 3 = 5, but our calculation shows that the actual maximum is 13/4 = 3.25.

So the maximum is less than 5, which makes sense because the two terms are not independent.

Alternatively, think about when 2cosθ - 1 is maximized. For maximum |2cosθ - 1|, it occurs when cosθ is either 1 or -1. At cosθ = 1, |2*1 -1| = 1, and |1 + z| = |1 + 1| = 2, sum is 3. At cosθ = -1, |2*(-1) - 1| = 3, and |1 + z| = |1 + (-1)| = 0, sum is 3. So these give 3. But our maximum is higher. Therefore, there's a combination where both terms are not at their individual maxima, but their sum is higher.

Therefore, the maximum occurs somewhere in between.

Another check: if I consider θ where both terms contribute positively. For example, if 2cosθ - 1 is positive and |cos(θ/2)| is also positive.

But regardless, through all methods, it seems that 13/4 is the maximum value. Therefore, I think this is the correct answer.

But just to make sure, let me check if when x = -7/8, which is cosθ = -7/8, is there another expression that can confirm this?

Alternatively, since we have z = e^(iθ), with cosθ = -7/8, sinθ = sqrt(1 - (49/64)) = sqrt(15/64) = sqrt(15)/8. So z = cosθ + i sinθ = -7/8 + i*sqrt(15)/8.

Compute |1 + z|: 1 + z = 1 + (-7/8) + i*sqrt(15)/8 = 1/8 + i*sqrt(15)/8. The modulus is sqrt( (1/8)^2 + (sqrt(15)/8)^2 ) = sqrt( (1 + 15)/64 ) = sqrt(16/64) = sqrt(1/4) = 1/2. Correct.

Compute |1 - z + z²|. First compute z²: z² = (-7/8 + i*sqrt(15)/8)^2.

Let me compute z²:

= (-7/8)^2 + 2*(-7/8)*(i*sqrt(15)/8) + (i*sqrt(15)/8)^2

= 49/64 - (14i sqrt(15))/64 + (i² * 15)/64

= 49/64 - (14i sqrt(15))/64 - 15/64

= (49 - 15)/64 - (14i sqrt(15))/64

= 34/64 - (14i sqrt(15))/64

= 17/32 - (7i sqrt(15))/32

Now compute 1 - z + z²:

1 - z + z² = 1 - (-7/8 + i*sqrt(15)/8) + [17/32 - 7i sqrt(15)/32]

= 1 + 7/8 - i*sqrt(15)/8 + 17/32 - 7i sqrt(15)/32

Convert 1 to 32/32, 7/8 to 28/32:

= 32/32 + 28/32 - i*sqrt(15)/8 + 17/32 - 7i sqrt(15)/32

Add real parts: 32 + 28 + 17 = 77/32

Imaginary parts: -i sqrt(15)/8 - 7i sqrt(15)/32 = (-4i sqrt(15)/32 - 7i sqrt(15)/32) = -11i sqrt(15)/32

Therefore, 1 - z + z² = 77/32 - 11i sqrt(15)/32

Compute modulus: sqrt( (77/32)^2 + (11 sqrt(15)/32)^2 )

Compute numerator:

77² + (11² * 15) = 5929 + 121*15. Let me compute 121 * 15: 120*15 = 1800, 1*15=15, total 1815. Therefore total is 5929 + 1815 = 7744. Therefore sqrt(7744 / (32²)) = sqrt(7744)/32.

sqrt(7744): 88² = 7744. Therefore, 88/32 = 11/4. Therefore modulus is 11/4.

Therefore, |1 - z + z²| = 11/4, and |1 + z| = 1/2. Therefore total expression is 1/2 + 11/4 = 13/4.

Therefore, this confirms again.

Therefore, after thorough analysis, I can be confident that the maximum value is 13/4.

**Final Answer**
The maximum value is \boxed{\dfrac{13}{4}}.

To find the maximum value of the expression
$$
|1 + z| + |1 - z + z^2|
$$
given that $ z \in \mathbb{C} $ and $ |z| = 1 $, we begin by recognizing that since $ |z| = 1 $, $ z $ lies on the unit circle in the complex plane. Every such $ z $ can be written in the form
$$
z = e^{i\theta},
$$
where $ \theta \in [0, 2\pi) $.

---

### Step 1: Express the Terms Using Euler's Formula

Using the identity $ e^{i\theta} = \cos\theta + i\sin\theta $, we can express the first term as:
$$
|1 + z| = |1 + e^{i\theta}| = \sqrt{(1 + \cos\theta)^2 + \sin^2\theta} = \sqrt{2(1 + \cos\theta)}.
$$
This simplifies further using the identity $ 1 + \cos\theta = 2\cos^2\left(\frac{\theta}{2}\right) $, so:
$$
|1 + z| = \sqrt{2 \cdot 2\cos^2\left(\frac{\theta}{2}\right)} = 2\left|\cos\left(\frac{\theta}{2}\right)\right|.
$$

---

### Step 2: Simplify the Second Term

Now consider the second term:
$$
|1 - z + z^2| = |z^2 - z + 1|.
$$
Write this in terms of $ e^{i\theta} $:
$$
z^2 - z + 1 = e^{i2\theta} - e^{i\theta} + 1.
$$
Adding $ \sin\theta $ and $ \cos\theta $, we find that the modulus becomes:
$$
|z^2 - z + 1| = |2\cos\theta - 1|.
$$

---

### Step 3: Combine the Two Terms and Change of Variables

Now, the entire expression becomes:
$$
f(\theta) = |1 + z| + |1 - z + z^2| = 2\left|\cos\left(\frac{\theta}{2}\right)\right| + |2\cos\theta - 1|.
$$
Let us now introduce a substitution:
Let $ x = \cos\theta $. Then, since $ \theta \in [0, 2\pi) $, we have $ x \in [-1, 1] $. Also, using the identity:
$$
\cos\left(\frac{\theta}{2}\right) = \sqrt{\frac{1 + \cos\theta}{2}},
$$
we find that the term $ \left|\cos\left(\frac{\theta}{2}\right)\right| = \sqrt{\frac{1 + x}{2}} $.

So the function becomes:
$$
f(x) = 2\sqrt{\frac{1 + x}{2}} + |2x - 1| = \sqrt{2(1 + x)} + |2x - 1|.
$$

---

### Step 4: Analyze the Function on $ x \in [-1, 1] $

Now we analyze $ f(x) = \sqrt{2(1 + x)} + |2x - 1| $ on $ x \in [-1, 1] $.

We break it into two cases based on the critical point of the absolute value:

- For $ x \in [-1, \frac{1}{2}] $, $ 2x - 1 < 0 $, so $ |2x - 1| = 1 - 2x $. The function becomes:
  $$
  f_1(x) = \sqrt{2(1 + x)} + 1 - 2x.
  $$

- For $ x \in [\frac{1}{2}, 1] $, $ 2x - 1 \geq 0 $, so $ |2x - 1| = 2x - 1 $. The function becomes:
  $$
  f_2(x) = \sqrt{2(1 + x)} + 2x - 1.
  $$

We analyze both cases.

---

#### Case 1: $ f_1(x) = \sqrt{2(1 + x)} + 1 - 2x $, $ x \in [-1, \frac{1}{2}] $

Take derivative:
$$
f_1'(x) = \frac{1}{\sqrt{2(1 + x)}} - 2.
$$
Set derivative to zero:
$$
\frac{1}{\sqrt{2(1 + x)}} = 2 \Rightarrow \sqrt{2(1 + x)} = \frac{1}{2} \Rightarrow 2(1 + x) = \frac{1}{4} \Rightarrow x = -\frac{7}{8}.
$$

Evaluate $ f_1(x) $ at critical point and endpoints:
- $ f_1(-1) = \sqrt{2(0)} + 1 - 2(-1) = 0 + 1 + 2 = 3 $
- $ f_1(-\frac{7}{8}) = \sqrt{2(1 - \frac{7}{8})} + 1 - 2(-\frac{7}{8}) = \sqrt{2 \cdot \frac{1}{8}} + 1 + \frac{7}{4} = \frac{1}{2} + \frac{11}{4} = \frac{13}{4} $
- $ f_1(\frac{1}{2}) = \sqrt{2(1 + \frac{1}{2})} + 1 - 2(\frac{1}{2}) = \sqrt{3} + 1 - 1 = \sqrt{3} \approx 1.732 $

So maximum in this interval is $ \frac{13}{4} $.

---

#### Case 2: $ f_2(x) = \sqrt{2(1 + x)} + 2x - 1 $, $ x \in [\frac{1}{2}, 1] $

Derivative:
$$
f_2'(x) = \frac{1}{\sqrt{2(1 + x)}} + 2 > 0, \text{ always increasing}.
$$
So maximum at $ x = 1 $:
$$
f_2(1) = \sqrt{2(1 + 1)} + 2(1) - 1 = \sqrt{4} + 2 - 1 = 2 + 1 = 3
$$

---

### Final Conclusion

The maximum value of the expression is achieved when $ x = -\frac{7}{8} $, corresponding to $ \cos\theta = -\frac{7}{8} $, and it is:
$$
\boxed{\dfrac{13}{4}}
$$

[Assistant]
Explanation:
Okay, so I need to find the maximum value of the expression |1 + z| + |1 - z + z²| where z is a complex number with |z| = 1. Hmm, let me think about how to approach this.

First, since |z| = 1, z lies on the unit circle in the complex plane. That means I can represent z as e^(iθ) where θ is the argument of z. So maybe I can write z = e^(iθ) and then express both |1 + z| and |1 - z + z²| in terms of θ. Then, I can try to maximize the sum of these two absolute values.

Let me start by writing down z = e^(iθ). Then:

First term: |1 + z| = |1 + e^(iθ)|.

I remember that |1 + e^(iθ)| can be simplified. Let me recall the formula for the modulus of a complex number. If I have a complex number in the form a + ib, its modulus is √(a² + b²). Alternatively, for |1 + e^(iθ)|, using Euler's formula, e^(iθ) = cosθ + i sinθ. So adding 1 gives 1 + cosθ + i sinθ.

Then |1 + e^(iθ)| = √[(1 + cosθ)² + (sinθ)²]. Let me compute that:

(1 + cosθ)² + (sinθ)² = 1 + 2cosθ + cos²θ + sin²θ. Since cos²θ + sin²θ = 1, this becomes 1 + 2cosθ + 1 = 2 + 2cosθ. Therefore, |1 + e^(iθ)| = √(2 + 2cosθ) = √[2(1 + cosθ)].

Alternatively, using the identity 1 + cosθ = 2cos²(θ/2), so this becomes √[2 * 2cos²(θ/2)] = √[4cos²(θ/2)] = 2|cos(θ/2)|. Since θ is an angle, cos(θ/2) can be positive or negative, but modulus is non-negative. However, since we are dealing with modulus, maybe we can write it as 2|cos(θ/2)|. However, since θ is an angle parameterizing the unit circle, θ can range from 0 to 2π. Therefore, θ/2 ranges from 0 to π, so cos(θ/2) can be positive or negative. Wait, but cos(θ/2) is positive when θ/2 is between -π/2 to π/2, but θ is between 0 and 2π, so θ/2 is between 0 and π. So cos(θ/2) is positive when θ is between 0 and π, and negative when θ is between π and 2π. Therefore, |cos(θ/2)| is cos(θ/2) when θ ∈ [0, π], and -cos(θ/2) when θ ∈ [π, 2π].

But maybe there's another way to write |1 + z|. Alternatively, using complex numbers, |1 + z| is the distance from -1 to z on the complex plane. Since z is on the unit circle, the distance from -1 to z is 2|cos(θ/2)|, as we derived earlier.

But maybe instead of getting bogged down here, I can note that |1 + z| = 2|cos(θ/2)|. So that simplifies the first term.

Now moving on to the second term: |1 - z + z²|. Let me try to simplify this expression. Maybe I can factor or rewrite it in terms of z. Let me see:

Let me write down the expression: 1 - z + z². Let me consider z² - z + 1. Hmm, is there a way to factor this quadratic? Let me check the discriminant. For a quadratic equation z² - z + 1 = 0, discriminant D = (-1)^2 - 4*1*1 = 1 - 4 = -3. So it doesn't factor over real numbers, but since we're dealing with complex numbers, perhaps we can write it as something else? Alternatively, maybe I can express this in terms of z³?

Alternatively, since z is on the unit circle, |z| = 1, so z̄ = 1/z. Maybe that could be helpful? Let me think.

But let me first try to compute |1 - z + z²|. Let me write it as |z² - z + 1|. Let me note that z² - z + 1 is similar to z³ + 1? Wait, z³ - 1 factors as (z - 1)(z² + z + 1). So z² + z + 1 = (z³ - 1)/(z - 1). But our expression is z² - z + 1. Hmm, not quite the same. Let me see:

Alternatively, perhaps I can relate it to z³? Let me compute z³ - 1 = (z - 1)(z² + z + 1). So if we have z² - z + 1, that's similar but different. Maybe if I manipulate:

z² - z + 1 = z² + z + 1 - 2z = (z² + z + 1) - 2z. But not sure if that helps. Alternatively, maybe consider multiplying by z?

Wait, but maybe instead of trying to factor, I can compute its modulus directly. Let me write z = e^(iθ) again, so z² = e^(i2θ). Then:

1 - z + z² = 1 - e^(iθ) + e^(i2θ). Let me write this in terms of sine and cosine:

1 - cosθ - i sinθ + cos2θ + i sin2θ. Then combining real and imaginary parts:

Real part: 1 - cosθ + cos2θ

Imaginary part: -sinθ + sin2θ

Therefore, modulus squared is [1 - cosθ + cos2θ]^2 + [-sinθ + sin2θ]^2. Let me compute this expression. Maybe simplifying step by step.

First, let me compute 1 - cosθ + cos2θ. Let me recall that cos2θ = 2cos²θ - 1, so substituting:

1 - cosθ + 2cos²θ - 1 = -cosθ + 2cos²θ = 2cos²θ - cosθ.

Similarly, the imaginary part: -sinθ + sin2θ. And sin2θ = 2sinθcosθ. So this becomes -sinθ + 2sinθcosθ = sinθ(-1 + 2cosθ).

So modulus squared is [2cos²θ - cosθ]^2 + [sinθ(-1 + 2cosθ)]^2.

Let me factor out (-1 + 2cosθ) from both terms? Wait, notice that 2cos²θ - cosθ can be written as cosθ(2cosθ - 1). Similarly, the other term is sinθ(-1 + 2cosθ) = sinθ(2cosθ - 1). Therefore, modulus squared becomes [cosθ(2cosθ - 1)]² + [sinθ(2cosθ - 1)]² = (2cosθ - 1)² [cos²θ + sin²θ] = (2cosθ - 1)² * 1 = (2cosθ - 1)^2.

Wow, that's nice! Therefore, |1 - z + z²| = sqrt[(2cosθ - 1)^2] = |2cosθ - 1|.

So that simplifies the second term! Therefore, the original expression becomes |1 + z| + |1 - z + z²| = 2|cos(θ/2)| + |2cosθ - 1|.

So now, the problem reduces to finding the maximum value of 2|cos(θ/2)| + |2cosθ - 1| where θ ∈ [0, 2π).

Okay, so now I need to analyze the function f(θ) = 2|cos(θ/2)| + |2cosθ - 1|.

This seems more manageable. Let me note that θ is in [0, 2π), so θ/2 is in [0, π). Therefore, cos(θ/2) is non-negative when θ ∈ [0, π] and non-positive when θ ∈ [π, 2π). Therefore, |cos(θ/2)| = cos(θ/2) for θ ∈ [0, π], and |cos(θ/2)| = -cos(θ/2) for θ ∈ [π, 2π).

Therefore, we can split the analysis into two intervals: θ ∈ [0, π] and θ ∈ [π, 2π). However, perhaps there is some symmetry. Let me check.

Alternatively, since cosθ is symmetric around θ = π, maybe we can consider θ ∈ [0, π] and then double-check if the maximum occurs there or elsewhere. But let me proceed step by step.

First, let me consider θ ∈ [0, π]. In this case, |cos(θ/2)| = cos(θ/2), so f(θ) = 2cos(θ/2) + |2cosθ - 1|.

Similarly, for θ ∈ [π, 2π], |cos(θ/2)| = -cos(θ/2) (since θ/2 ∈ [π/2, π), so cos(θ/2) ≤ 0), so f(θ) = -2cos(θ/2) + |2cosθ - 1|.

But before going further, perhaps I can make substitution variables to simplify. Let me consider x = θ. Alternatively, let me set φ = θ/2. Since θ ∈ [0, π], then φ ∈ [0, π/2], and for θ ∈ [π, 2π], φ ∈ [π/2, π]. Let me check:

If θ ∈ [0, π], then φ = θ/2 ∈ [0, π/2]. Then cosφ is non-negative, so |cosφ| = cosφ. For θ ∈ [π, 2π], φ ∈ [π/2, π], and cosφ is non-positive, so |cosφ| = -cosφ.

But maybe this substitution can help. Let me see.

Alternatively, since cosθ can be expressed in terms of cosφ. Let me note that θ = 2φ. Therefore, cosθ = cos(2φ) = 2cos²φ - 1. Therefore, in terms of φ, the expression becomes:

For θ ∈ [0, π] (φ ∈ [0, π/2]):

f(θ) = 2cosφ + |2cosθ - 1| = 2cosφ + |2*(2cos²φ - 1) - 1| = 2cosφ + |4cos²φ - 2 - 1| = 2cosφ + |4cos²φ - 3|.

Similarly, for θ ∈ [π, 2π] (φ ∈ [π/2, π]):

f(θ) = -2cosφ + |2cosθ - 1| = -2cosφ + |2*(2cos²φ - 1) - 1| = -2cosφ + |4cos²φ - 3|.

Therefore, in both cases, the function becomes:

For φ ∈ [0, π/2], f(φ) = 2cosφ + |4cos²φ - 3|,

and for φ ∈ [π/2, π], f(φ) = -2cosφ + |4cos²φ - 3|.

Wait, but maybe we can analyze the entire function over φ ∈ [0, π], considering the absolute value. Let me note that 4cos²φ - 3 is inside the absolute value. Let me denote y = cosφ. Then, since φ ∈ [0, π], y ∈ [-1, 1]. However, for φ ∈ [0, π/2], y ∈ [0, 1], and for φ ∈ [π/2, π], y ∈ [-1, 0].

Therefore, for φ ∈ [0, π/2], y ∈ [0, 1], and 4y² - 3 is in [4*(0)^2 - 3, 4*(1)^2 - 3] = [-3, 1]. Therefore, |4y² - 3| is equal to 4y² - 3 when 4y² - 3 ≥ 0, i.e., when y² ≥ 3/4, so |y| ≥ √(3)/2. Since y ∈ [0, 1], this corresponds to y ≥ √(3)/2 ≈ 0.866.

Similarly, when y < √(3)/2, |4y² - 3| = 3 - 4y².

Similarly, for φ ∈ [π/2, π], y ∈ [-1, 0], so 4y² - 3 is still in [-3, 1], so same as before. However, since y is negative, but squared, so same as for the positive case. Therefore, the absolute value expression is still 4y² - 3 when |y| ≥ √(3)/2, and 3 - 4y² otherwise.

Therefore, we can split the analysis into cases where 4y² - 3 is positive or negative. Let me proceed.

Let me first consider φ ∈ [0, π/2], i.e., y ∈ [0, 1].

Case 1: y ∈ [0, √3/2]. Then |4y² - 3| = 3 - 4y². Therefore, f(φ) = 2y + 3 - 4y².

Case 2: y ∈ [√3/2, 1]. Then |4y² - 3| = 4y² - 3. Therefore, f(φ) = 2y + 4y² - 3.

Similarly, for φ ∈ [π/2, π], y ∈ [-1, 0]. Let me note that since we have |4y² - 3| again, same as above, but f(φ) = -2y + |4y² - 3|. However, since y is negative, -2y is positive. Let me check:

Original expression for φ ∈ [π/2, π]: f(φ) = -2cosφ + |4cos²φ - 3| = -2y + |4y² - 3|.

But since y ∈ [-1, 0], let me denote y = -k, where k ∈ [0, 1]. Then f(φ) becomes -2(-k) + |4(-k)^2 - 3| = 2k + |4k² - 3|. Which is same as the expression for φ ∈ [0, π/2], with variable substitution. Therefore, the function for φ ∈ [π/2, π] is symmetric to that of φ ∈ [0, π/2]. Therefore, the maximum over φ ∈ [π/2, π] would be same as the maximum over φ ∈ [0, π/2], but mirrored. Therefore, maybe we can focus on φ ∈ [0, π/2] and analyze there, then the maximum will also be achieved in φ ∈ [π/2, π], but perhaps same value. Therefore, perhaps I can consider the entire interval φ ∈ [0, π], but with y ∈ [-1, 1].

But maybe to be thorough, let me proceed step by step.

First, let's analyze φ ∈ [0, π/2], which corresponds to θ ∈ [0, π], and then φ ∈ [π/2, π] corresponds to θ ∈ [π, 2π].

Let me first handle φ ∈ [0, π/2]. Let me consider Case 1 and Case 2.

Case 1: y ∈ [0, √3/2]. Then f(φ) = 2y + 3 - 4y². Let me denote this as f1(y) = -4y² + 2y + 3.

This is a quadratic function in y, opening downward (coefficient -4). Its maximum occurs at vertex. The vertex of a quadratic ax² + bx + c is at -b/(2a). So here, a = -4, b = 2. Therefore, vertex at y = -2/(2*(-4)) = -2 / (-8) = 1/4.

But since in this case, y ∈ [0, √3/2 ≈ 0.866]. Therefore, the maximum of f1(y) in this interval occurs either at y = 1/4 or at the endpoints. Let me check f1 at y = 0, y = √3/2, and y = 1/4.

First, f1(0) = -0 + 0 + 3 = 3.

f1(√3/2) = -4*( (√3/2)^2 ) + 2*(√3/2) + 3 = -4*(3/4) + √3 + 3 = -3 + √3 + 3 = √3 ≈ 1.732.

f1(1/4) = -4*(1/4)^2 + 2*(1/4) + 3 = -4*(1/16) + 1/2 + 3 = -1/4 + 1/2 + 3 = 1/4 + 3 = 3.25.

So the maximum in Case 1 is 3.25 at y = 1/4.

Case 2: y ∈ [√3/2, 1]. Then f(φ) = 2y + 4y² - 3. Let me denote this as f2(y) = 4y² + 2y - 3. This is a quadratic in y, opening upwards (a = 4). Therefore, its minimum is at vertex, and maximum would be at endpoints of the interval.

Compute f2 at y = √3/2 and y = 1.

First, f2(√3/2) = 4*( (√3/2)^2 ) + 2*(√3/2) - 3 = 4*(3/4) + √3 - 3 = 3 + √3 - 3 = √3 ≈ 1.732.

f2(1) = 4*(1)^2 + 2*1 - 3 = 4 + 2 - 3 = 3.

Therefore, the maximum in Case 2 is 3 at y = 1.

Therefore, for φ ∈ [0, π/2], the maximum of f(φ) is 3.25 (which is 13/4) at y = 1/4.

Now, moving to φ ∈ [π/2, π]. As mentioned earlier, since this interval corresponds to y ∈ [-1, 0], and the function becomes 2k + |4k² - 3| where k = -y ∈ [0, 1]. Therefore, this is same as the Case 1 and Case 2 for k ∈ [0, 1]. Therefore, the maximum in this interval would also be 13/4.

Therefore, overall, the maximum of the function f(θ) is 13/4? Wait, but let me check whether this is correct. Wait, 13/4 is 3.25, which is larger than the maximum in the other cases. However, I need to make sure that there isn't a higher value in other regions. Wait, but since we considered both intervals, and the maxima there are 3.25 and 3. So 3.25 is higher.

Wait, but let me check if there are any other critical points? For example, when considering the absolute value function, sometimes there might be maxima at the points where the expression inside the absolute value is zero.

Wait, the expression |4y² - 3| has a zero when 4y² - 3 = 0 => y² = 3/4 => y = ±√3/2. Therefore, at y = √3/2 and y = -√3/2.

But we already considered these points in our Case 1 and Case 2.

But maybe there are other critical points? For example, when we have different expressions for f(θ) depending on y.

But in our analysis, we considered splitting into cases based on the sign of 4y² - 3. Therefore, we have considered all possibilities.

Therefore, the maximum value of f(θ) is 13/4? Wait, but hold on. Let me check with specific values.

For example, when y = 1/4, which is in Case 1 (since 1/4 < √3/2 ≈ 0.866). Let me compute θ corresponding to y = 1/4. Since y = cosφ = 1/4, φ = arccos(1/4). Therefore, θ = 2φ. Let me compute |1 + z| + |1 - z + z²| in this case.

But maybe instead of going back to θ, I can check whether the value of 13/4 is indeed achievable.

Alternatively, let me verify the calculation of f1(1/4):

f1(y) = -4y² + 2y + 3. If y = 1/4:

-4*(1/4)^2 + 2*(1/4) + 3 = -4*(1/16) + 1/2 + 3 = -1/4 + 1/2 + 3 = 1/4 + 3 = 3.25 = 13/4. Yes.

But let me check if that's indeed the maximum. However, is there a possibility that when considering θ ∈ [π, 2π], there could be a higher value? For example, if we take θ such that cosθ is negative? Let me think.

Wait, when θ ∈ [π, 2π], we had the function f(φ) = -2y + |4y² - 3|, where y = cosφ, φ ∈ [π/2, π], so y ∈ [-1, 0]. If I take y = -1/4, then k = 1/4, and f(φ) becomes 2*(1/4) + |4*(1/4)^2 - 3| = 1/2 + |4*(1/16) - 3| = 1/2 + |1/4 - 3| = 1/2 + | -11/4 | = 1/2 + 11/4 = 13/4. So same value. Therefore, in this case, when y = -1/4, same value.

Therefore, the maximum value is 13/4? Wait, but is there a way to get a higher value?

Wait, let me check another point. For example, when θ = π. Then z = e^(iπ) = -1. Then compute |1 + z| + |1 - z + z²|.

First term: |1 + (-1)| = |0| = 0.

Second term: |1 - (-1) + (-1)^2| = |1 + 1 + 1| = |3| = 3. Therefore, total is 0 + 3 = 3, which is less than 13/4 (which is 3.25).

Another point: θ = 0. Then z = 1. |1 + 1| + |1 - 1 + 1| = |2| + |1| = 2 + 1 = 3. Again, same as above.

What about θ = π/2? Then z = i. Let me compute:

First term: |1 + i| = √(1 + 1) = √2 ≈ 1.414.

Second term: |1 - i + i²| = |1 - i - 1| = | -i | = 1. Therefore total is √2 + 1 ≈ 2.414, less than 3.25.

Another point: Let me take θ where cosθ = -1/4. Let me see. Wait, for φ ∈ [π/2, π], y = cosφ = -1/4, so θ = 2φ. Let me compute φ such that cosφ = -1/4. Then φ = arccos(-1/4), which is in [π/2, π]. Then θ = 2φ. Let me compute |1 + z| + |1 - z + z²| here. Wait, but we already know that in this case, f(θ) is 13/4. Therefore, that is correct.

But let me check with θ = 2φ where φ = arccos(-1/4). Let me compute z = e^(iθ) = e^(i*2φ). But since cosφ = -1/4, sinφ = sqrt(1 - (1/4)^2) = sqrt(15)/4. Therefore, φ is in the second quadrant. Then θ = 2φ. Let me compute cosθ = cos(2φ) = 2cos²φ - 1 = 2*(1/16) - 1 = 1/8 - 1 = -7/8. Therefore, cosθ = -7/8. Then 2cosθ - 1 = 2*(-7/8) - 1 = -14/8 - 8/8 = -22/8 = -11/4. Therefore, |2cosθ - 1| = 11/4. Also, |1 + z| = 2|cos(θ/2)|. Since θ/2 = φ, and cosφ = -1/4, so |cosφ| = 1/4. Therefore, 2*(1/4) = 1/2. Therefore, total expression is 1/2 + 11/4 = 13/4. Yes, that checks out.

So indeed, 13/4 is achievable. Is it the maximum?

Wait, let me check another point. Suppose I take y = 0. Then, for φ ∈ [0, π/2], y = 0. Then f(φ) = 2*0 + |0 - 3| = 0 + 3 = 3. Which is less than 13/4.

What about y approaching √3/2? For example, y = √3/2. Then, in Case 1, f1(y) = √3 ≈ 1.732, which is less than 13/4.

Alternatively, maybe there are maxima where the derivative is zero. Let me check for the Case 1 function where we have f1(y) = -4y² + 2y + 3. We already found that its maximum is at y = 1/4. Similarly for the other cases.

But let me think if there's another way to approach this problem. Maybe using geometry?

Since z is on the unit circle, maybe we can interpret |1 + z| as the distance from z to -1, and |1 - z + z²| as another distance? Wait, but how?

Alternatively, perhaps we can consider writing z² - z + 1 in terms of z. Let me try:

z² - z + 1. But since z is on the unit circle, z̄ = 1/z. Maybe multiplying by z̄:

Wait, not sure. Alternatively, note that z² - z + 1 = z² + 1 - z. Maybe express it in terms of z + 1/z?

Wait, since z is on the unit circle, z + 1/z = 2cosθ. But z² + 1/z² = 2cos2θ. However, here we have z² - z + 1. Maybe not directly helpful.

Alternatively, think of |1 - z + z²|. Let me consider that as |z² - z + 1|. Let me compute this for specific z. For example, when z = e^(iθ). Earlier we found that it's |2cosθ - 1|. Therefore, maybe that's helpful.

So the original expression is 2|cos(θ/2)| + |2cosθ - 1|. So maybe we can parametrize in terms of cosθ. Let me set x = cosθ. Then, since θ ∈ [0, 2π), x ∈ [-1, 1]. Also, cos(θ/2) can be expressed in terms of x. Recall that cos(θ/2) = sqrt[(1 + cosθ)/2] or -sqrt[(1 + cosθ)/2], depending on θ. But since |cos(θ/2)| is always non-negative, we can write |cos(θ/2)| = sqrt[(1 + x)/2]. Wait, let me check:

cos(θ/2) = ±sqrt[(1 + cosθ)/2]. Therefore, |cos(θ/2)| = sqrt[(1 + cosθ)/2].

Therefore, the expression becomes:

sqrt[(1 + x)/2] * 2 + |2x - 1| = 2*sqrt[(1 + x)/2] + |2x - 1| = sqrt(2(1 + x)) + |2x - 1|.

So we can write the function as f(x) = sqrt(2(1 + x)) + |2x - 1| where x ∈ [-1, 1].

This is another way to represent the same function. So now, we can think of f(x) as sqrt(2(1 + x)) + |2x - 1|, with x ∈ [-1, 1].

This seems like a more manageable expression. Let me analyze this function. Let me consider the critical points where the absolute value changes, i.e., when 2x - 1 = 0 => x = 1/2. Therefore, we can split the interval [-1, 1] into two parts: x ∈ [-1, 1/2] and x ∈ [1/2, 1].

For x ∈ [-1, 1/2], 2x - 1 ≤ 0, so |2x - 1| = 1 - 2x. Therefore, f(x) = sqrt(2(1 + x)) + 1 - 2x.

For x ∈ [1/2, 1], |2x - 1| = 2x - 1. Therefore, f(x) = sqrt(2(1 + x)) + 2x - 1.

Therefore, we can analyze these two functions separately.

First, consider x ∈ [-1, 1/2], f(x) = sqrt(2(1 + x)) + 1 - 2x. Let me denote this as f1(x).

To find its maximum, compute derivative.

Let me compute f1'(x):

d/dx [sqrt(2(1 + x))] = (1/(2*sqrt(2(1 + x)))) * 2 = 1/sqrt(2(1 + x)).

Then derivative of 1 - 2x is -2. Therefore, f1'(x) = 1/sqrt(2(1 + x)) - 2.

Set derivative to zero:

1/sqrt(2(1 + x)) - 2 = 0 => 1/sqrt(2(1 + x)) = 2 => sqrt(2(1 + x)) = 1/2 => square both sides: 2(1 + x) = 1/4 => 1 + x = 1/8 => x = 1/8 - 1 = -7/8.

Therefore, critical point at x = -7/8. Now, check if this is in [-1, 1/2]. Yes, since -7/8 ≈ -0.875 is within [-1, 0.5].

Therefore, we need to evaluate f1 at x = -1, x = -7/8, and x = 1/2.

Compute f1(-1): sqrt(2(1 + (-1))) + 1 - 2*(-1) = sqrt(0) + 1 + 2 = 0 + 3 = 3.

Compute f1(-7/8): sqrt(2(1 + (-7/8))) + 1 - 2*(-7/8) = sqrt(2*(1/8)) + 1 + 14/8 = sqrt(1/4) + 1 + 7/4 = 1/2 + 1 + 1.75 = 1/2 + 2.75 = 3.25 = 13/4.

Compute f1(1/2): sqrt(2(1 + 1/2)) + 1 - 2*(1/2) = sqrt(2*(3/2)) + 1 - 1 = sqrt(3) + 0 ≈ 1.732.

Therefore, the maximum on x ∈ [-1, 1/2] is 13/4 at x = -7/8.

Now, consider x ∈ [1/2, 1], f(x) = sqrt(2(1 + x)) + 2x - 1. Let me denote this as f2(x).

Compute derivative f2'(x):

d/dx [sqrt(2(1 + x))] = 1/sqrt(2(1 + x)) as before.

Derivative of 2x - 1 is 2. Therefore, f2'(x) = 1/sqrt(2(1 + x)) + 2.

Since 1/sqrt(2(1 + x)) is always positive (since 1 + x > 0 for x ∈ [1/2,1]), adding 2 makes it always positive. Therefore, f2(x) is strictly increasing on [1/2, 1]. Therefore, its maximum occurs at x = 1.

Compute f2(1): sqrt(2*(1 + 1)) + 2*1 - 1 = sqrt(4) + 2 - 1 = 2 + 1 = 3.

Compute f2(1/2): sqrt(2*(1 + 1/2)) + 2*(1/2) - 1 = sqrt(3) + 1 - 1 = sqrt(3) ≈ 1.732.

Thus, on [1/2, 1], maximum is 3.

Therefore, overall, the maximum of f(x) is 13/4 = 3.25, achieved at x = -7/8. Therefore, the maximum value of the original expression is 13/4.

But let me check if this is correct by verifying with θ corresponding to x = -7/8.

Since x = cosθ = -7/8. Therefore, θ = arccos(-7/8). Then, |1 + z| = 2|cos(θ/2)|. Let me compute cos(θ/2).

Using the identity cos(θ/2) = sqrt[(1 + cosθ)/2] = sqrt[(1 - 7/8)/2] = sqrt[(1/8)/2] = sqrt(1/16) = 1/4. Wait, but θ is in [π, 2π], since cosθ = -7/8 is negative. Therefore, θ ∈ [π/2, 3π/2]? Wait, cosθ is negative in (π/2, 3π/2). But θ is in [0, 2π). However, since x = cosθ = -7/8, θ can be in (π/2, 3π/2). But then θ/2 would be in (π/4, 3π/4). Therefore, cos(θ/2) is positive in (π/4, π/2) and negative in (π/2, 3π/4). Wait, but we have |cos(θ/2)|, which is always non-negative.

But earlier, we derived that |cos(θ/2)| = sqrt[(1 + x)/2]. Since x = -7/8, (1 + x)/2 = (1 - 7/8)/2 = (1/8)/2 = 1/16. Therefore sqrt(1/16) = 1/4. Therefore, |1 + z| = 2*(1/4) = 1/2.

Then, |2x - 1| = |2*(-7/8) - 1| = |-14/8 - 8/8| = |-22/8| = 11/4. Therefore, total expression is 1/2 + 11/4 = 13/4.

Yes, that checks out. Therefore, the maximum value is indeed 13/4.

But just to make sure, let me check if there's any other critical points or if I missed something.

For example, when analyzing f(x) in terms of x, we found that the maximum occurs at x = -7/8, giving 13/4. Since all other intervals have lower maxima, this must be the global maximum.

Alternatively, let me consider another approach. Since z is on the unit circle, maybe we can use triangle inequality or other complex number properties.

But since we already have the answer through multiple methods, and verified with substitution, perhaps it's safe.

But just to confirm, let me consider another value of θ. Let me pick θ such that cosθ = -7/8. Let me compute z = e^(iθ). Then compute |1 + z| + |1 - z + z²| numerically.

Let me compute θ where cosθ = -7/8. Then θ ≈ arccos(-7/8). Let me compute θ in radians.

Let me compute arccos(-7/8). Since cosθ = -7/8, θ is in the second or third quadrant. Let me compute it numerically. Let me use approximate values.

cosθ = -0.875. arccos(-0.875) ≈ 2.63 radians (since π ≈ 3.14, so 2.63 is in the second quadrant).

Compute z = e^(iθ). Then |1 + z| = |1 + e^(iθ)|. As before, which is 2|cos(θ/2)|. θ ≈ 2.63, so θ/2 ≈ 1.315 radians. cos(1.315) ≈ cos(π - 1.827)? Wait, let me compute it numerically. cos(1.315) ≈ cos(1.315). Let me recall that cos(π/2) = 0, cos(π) = -1. π ≈ 3.14, so π/2 ≈ 1.57. Therefore, 1.315 is less than π/2? Wait, no: π/2 ≈ 1.57, so 1.315 is less than that. Wait, θ ≈ 2.63, θ/2 ≈ 1.315, so θ/2 is in first quadrant (since less than π/2)? Wait, π/2 ≈ 1.57, so 1.315 is less than π/2. Therefore, cos(θ/2) is positive. Therefore, |1 + z| = 2cos(θ/2).

Compute cos(θ/2): let me use the identity cos(θ/2) = sqrt[(1 + cosθ)/2] = sqrt[(1 - 7/8)/2] = sqrt[(1/8)/2] = sqrt(1/16) = 1/4. Therefore, |1 + z| = 2*(1/4) = 1/2.

Now compute |1 - z + z²|. Earlier we found that this is |2cosθ - 1|. cosθ = -7/8, so 2cosθ - 1 = 2*(-7/8) - 1 = -14/8 - 8/8 = -22/8 = -11/4. Therefore, absolute value is 11/4.

Therefore, the total is 1/2 + 11/4 = 13/4.

So yes, this confirms again. Therefore, it seems 13/4 is indeed the maximum value.

But let me check once more for another possible maximum. Suppose I consider cases where the absolute value terms could interact more. For example, when both terms are maximized. But since they are dependent on θ, it's not straightforward. However, we have already through calculus found the critical point.

Alternatively, think about geometric interpretations. The first term |1 + z| is the distance from z to -1, and the second term |1 - z + z²|. But how to interpret |1 - z + z²|?

Alternatively, since we found that |1 - z + z²| = |2cosθ - 1|. Therefore, if we think of 2cosθ - 1, which ranges between 2*(-1) -1 = -3 and 2*(1) -1 = 1. Therefore, |2cosθ - 1| ranges between 0 and 3.

But adding it to |1 + z|, which is between 0 and 2 (since |1 + z| = 2|cos(θ/2)|, and cos(θ/2) ranges from -1 to 1, so |cos(θ/2)| from 0 to 1, so 2|cos(θ/2)| from 0 to 2). Therefore, the maximum possible sum could be up to 2 + 3 = 5, but our calculation shows that the actual maximum is 13/4 = 3.25.

So the maximum is less than 5, which makes sense because the two terms are not independent.

Alternatively, think about when 2cosθ - 1 is maximized. For maximum |2cosθ - 1|, it occurs when cosθ is either 1 or -1. At cosθ = 1, |2*1 -1| = 1, and |1 + z| = |1 + 1| = 2, sum is 3. At cosθ = -1, |2*(-1) - 1| = 3, and |1 + z| = |1 + (-1)| = 0, sum is 3. So these give 3. But our maximum is higher. Therefore, there's a combination where both terms are not at their individual maxima, but their sum is higher.

Therefore, the maximum occurs somewhere in between.

Another check: if I consider θ where both terms contribute positively. For example, if 2cosθ - 1 is positive and |cos(θ/2)| is also positive.

But regardless, through all methods, it seems that 13/4 is the maximum value. Therefore, I think this is the correct answer.

But just to make sure, let me check if when x = -7/8, which is cosθ = -7/8, is there another expression that can confirm this?

Alternatively, since we have z = e^(iθ), with cosθ = -7/8, sinθ = sqrt(1 - (49/64)) = sqrt(15/64) = sqrt(15)/8. So z = cosθ + i sinθ = -7/8 + i*sqrt(15)/8.

Compute |1 + z|: 1 + z = 1 + (-7/8) + i*sqrt(15)/8 = 1/8 + i*sqrt(15)/8. The modulus is sqrt( (1/8)^2 + (sqrt(15)/8)^2 ) = sqrt( (1 + 15)/64 ) = sqrt(16/64) = sqrt(1/4) = 1/2. Correct.

Compute |1 - z + z²|. First compute z²: z² = (-7/8 + i*sqrt(15)/8)^2.

Let me compute z²:

= (-7/8)^2 + 2*(-7/8)*(i*sqrt(15)/8) + (i*sqrt(15)/8)^2

= 49/64 - (14i sqrt(15))/64 + (i² * 15)/64

= 49/64 - (14i sqrt(15))/64 - 15/64

= (49 - 15)/64 - (14i sqrt(15))/64

= 34/64 - (14i sqrt(15))/64

= 17/32 - (7i sqrt(15))/32

Now compute 1 - z + z²:

1 - z + z² = 1 - (-7/8 + i*sqrt(15)/8) + [17/32 - 7i sqrt(15)/32]

= 1 + 7/8 - i*sqrt(15)/8 + 17/32 - 7i sqrt(15)/32

Convert 1 to 32/32, 7/8 to 28/32:

= 32/32 + 28/32 - i*sqrt(15)/8 + 17/32 - 7i sqrt(15)/32

Add real parts: 32 + 28 + 17 = 77/32

Imaginary parts: -i sqrt(15)/8 - 7i sqrt(15)/32 = (-4i sqrt(15)/32 - 7i sqrt(15)/32) = -11i sqrt(15)/32

Therefore, 1 - z + z² = 77/32 - 11i sqrt(15)/32

Compute modulus: sqrt( (77/32)^2 + (11 sqrt(15)/32)^2 )

Compute numerator:

77² + (11² * 15) = 5929 + 121*15. Let me compute 121 * 15: 120*15 = 1800, 1*15=15, total 1815. Therefore total is 5929 + 1815 = 7744. Therefore sqrt(7744 / (32²)) = sqrt(7744)/32.

sqrt(7744): 88² = 7744. Therefore, 88/32 = 11/4. Therefore modulus is 11/4.

Therefore, |1 - z + z²| = 11/4, and |1 + z| = 1/2. Therefore total expression is 1/2 + 11/4 = 13/4.

Therefore, this confirms again.

Therefore, after thorough analysis, I can be confident that the maximum value is 13/4.

**Final Answer**
The maximum value is \boxed{\dfrac{13}{4}}.

To find the maximum value of the expression
$$
|1 + z| + |1 - z + z^2|
$$
given that $ z \in \mathbb{C} $ and $ |z| = 1 $, we begin by recognizing that since $ |z| = 1 $, $ z $ lies on the unit circle in the complex plane. Every such $ z $ can be written in the form
$$
z = e^{i\theta},
$$
where $ \theta \in [0, 2\pi) $.

---

### Step 1: Express the Terms Using Euler's Formula

Using the identity $ e^{i\theta} = \cos\theta + i\sin\theta $, we can express the first term as:
$$
|1 + z| = |1 + e^{i\theta}| = \sqrt{(1 + \cos\theta)^2 + \sin^2\theta} = \sqrt{2(1 + \cos\theta)}.
$$
This simplifies further using the identity $ 1 + \cos\theta = 2\cos^2\left(\frac{\theta}{2}\right) $, so:
$$
|1 + z| = \sqrt{2 \cdot 2\cos^2\left(\frac{\theta}{2}\right)} = 2\left|\cos\left(\frac{\theta}{2}\right)\right|.
$$

---

### Step 2: Simplify the Second Term

Now consider the second term:
$$
|1 - z + z^2| = |z^2 - z + 1|.
$$
Write this in terms of $ e^{i\theta} $:
$$
z^2 - z + 1 = e^{i2\theta} - e^{i\theta} + 1.
$$
Adding $ \sin\theta $ and $ \cos\theta $, we find that the modulus becomes:
$$
|z^2 - z + 1| = |2\cos\theta - 1|.
$$

---

### Step 3: Combine the Two Terms and Change of Variables

Now, the entire expression becomes:
$$
f(\theta) = |1 + z| + |1 - z + z^2| = 2\left|\cos\left(\frac{\theta}{2}\right)\right| + |2\cos\theta - 1|.
$$
Let us now introduce a substitution:
Let $ x = \cos\theta $. Then, since $ \theta \in [0, 2\pi) $, we have $ x \in [-1, 1] $. Also, using the identity:
$$
\cos\left(\frac{\theta}{2}\right) = \sqrt{\frac{1 + \cos\theta}{2}},
$$
we find that the term $ \left|\cos\left(\frac{\theta}{2}\right)\right| = \sqrt{\frac{1 + x}{2}} $.

So the function becomes:
$$
f(x) = 2\sqrt{\frac{1 + x}{2}} + |2x - 1| = \sqrt{2(1 + x)} + |2x - 1|.
$$

---

### Step 4: Analyze the Function on $ x \in [-1, 1] $

Now we analyze $ f(x) = \sqrt{2(1 + x)} + |2x - 1| $ on $ x \in [-1, 1] $.

We break it into two cases based on the critical point of the absolute value:

- For $ x \in [-1, \frac{1}{2}] $, $ 2x - 1 < 0 $, so $ |2x - 1| = 1 - 2x $. The function becomes:
  $$
  f_1(x) = \sqrt{2(1 + x)} + 1 - 2x.
  $$

- For $ x \in [\frac{1}{2}, 1] $, $ 2x - 1 \geq 0 $, so $ |2x - 1| = 2x - 1 $. The function becomes:
  $$
  f_2(x) = \sqrt{2(1 + x)} + 2x - 1.
  $$

We analyze both cases.

---

#### Case 1: $ f_1(x) = \sqrt{2(1 + x)} + 1 - 2x $, $ x \in [-1, \frac{1}{2}] $

Take derivative:
$$
f_1'(x) = \frac{1}{\sqrt{2(1 + x)}} - 2.
$$
Set derivative to zero:
$$
\frac{1}{\sqrt{2(1 + x)}} = 2 \Rightarrow \sqrt{2(1 + x)} = \frac{1}{2} \Rightarrow 2(1 + x) = \frac{1}{4} \Rightarrow x = -\frac{7}{8}.
$$

Evaluate $ f_1(x) $ at critical point and endpoints:
- $ f_1(-1) = \sqrt{2(0)} + 1 - 2(-1) = 0 + 1 + 2 = 3 $
- $ f_1(-\frac{7}{8}) = \sqrt{2(1 - \frac{7}{8})} + 1 - 2(-\frac{7}{8}) = \sqrt{2 \cdot \frac{1}{8}} + 1 + \frac{7}{4} = \frac{1}{2} + \frac{11}{4} = \frac{13}{4} $
- $ f_1(\frac{1}{2}) = \sqrt{2(1 + \frac{1}{2})} + 1 - 2(\frac{1}{2}) = \sqrt{3} + 1 - 1 = \sqrt{3} \approx 1.732 $

So maximum in this interval is $ \frac{13}{4} $.

---

#### Case 2: $ f_2(x) = \sqrt{2(1 + x)} + 2x - 1 $, $ x \in [\frac{1}{2}, 1] $

Derivative:
$$
f_2'(x) = \frac{1}{\sqrt{2(1 + x)}} + 2 > 0, \text{ always increasing}.
$$
So maximum at $ x = 1 $:
$$
f_2(1) = \sqrt{2(1 + 1)} + 2(1) - 1 = \sqrt{4} + 2 - 1 = 2 + 1 = 3
$$

---

### Final Conclusion

The maximum value of the expression is achieved when $ x = -\frac{7}{8} $, corresponding to $ \cos\theta = -\frac{7}{8} $, and it is:
$$
\boxed{\dfrac{13}{4}}
$$

Solution:
Let $z = x + yi,$ where $x$ and $y$ are real numbers.  Since $|z| = 1,$ $x^2 + y^2 = 1.$  Then
\begin{align*}
|1 + z| + |1 - z + z^2| &= |1 + x + yi| + |1 - x - yi + x^2 + 2xyi - y^2| \\
&= |(1 + x) + yi| + |(1 - x + x^2 - 1 + x^2) + (-y + 2xy)i| \\
&= |(1 + x) + yi| + |(-x + 2x^2) + (-y + 2xy)i| \\
&= \sqrt{(1 + x)^2 + y^2} + \sqrt{(-x + 2x^2)^2 + (-y + 2xy)^2} \\
&= \sqrt{(1 + x)^2 + y^2} + \sqrt{(-x + 2x^2)^2 + y^2 (1 - 2x)^2} \\
&= \sqrt{(1 + x)^2 + 1 - x^2} + \sqrt{(-x + 2x^2)^2 + (1 - x^2) (1 - 2x)^2} \\
&= \sqrt{2 + 2x} + \sqrt{1 - 4x + 4x^2} \\
&= \sqrt{2 + 2x} + |1 - 2x|.
\end{align*}Let $u = \sqrt{2 + 2x}.$  Then $u^2 = 2 + 2x,$ so
\[\sqrt{2 + 2x} + |1 - 2x| = u + |3 - u^2|.\]Since $-1 \le x \le 1,$ $0 \le u \le 2.$

If $0 \le u \le \sqrt{3},$ then
\[u + |3 - u^2| = u + 3 - u^2 = \frac{13}{4} - \left( u - \frac{1}{2} \right)^2 \le \frac{13}{4}.\]Equality occurs when $u = \frac{1}{2},$ or $x = -\frac{7}{8}.$

If $\sqrt{3} \le u \le 2,$ then
\[u + u^2 - 3 = \left( u + \frac{1}{2} \right)^2 - \frac{13}{4} \le \left( 2 + \frac{1}{2} \right)^2 - \frac{13}{4} = 3 < \frac{13}{4}.\]Therefore, the maximum value is $\boxed{\frac{13}{4}}.$