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 start by recalling that if |z| = 1, then 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. Maybe that will help me convert the problem into trigonometric terms?

Let me write z = e^(iθ). Then, I can express each modulus in terms of θ. Let me compute each part step by step.

First, compute |1 + z|. Since z = e^(iθ), then 1 + z = 1 + e^(iθ). The modulus of this is |1 + e^(iθ)|. I remember that |1 + e^(iθ)| can be simplified using the formula for the modulus of a complex number. Let me recall that |a + b|² = |a|² + |b|² + 2Re(a\overline{b}), but maybe there's a simpler way here.

Alternatively, since 1 + e^(iθ) = e^(iθ/2) * 2cos(θ/2). Wait, is that right? Let me check. Let me write 1 + e^(iθ) as e^(iθ/2)(e^(-iθ/2) + e^(iθ/2)) = e^(iθ/2) * 2cos(θ/2). Yes, that's correct. Therefore, |1 + e^(iθ)| = |2cos(θ/2)|. So |1 + z| = 2|cos(θ/2)|. Okay, that's helpful.

Now, moving on to the second term: |1 - z + z²|. Let me try to simplify this expression. Let me write it as |z² - z + 1|. Maybe I can factor this or find a way to express it in terms of θ?

Alternatively, since z is on the unit circle, z² is also on the unit circle, and so is -z. Let me try to compute this modulus. Let me write z = e^(iθ), so z² = e^(i2θ), and -z = -e^(iθ). Therefore, the expression inside the modulus is e^(i2θ) - e^(iθ) + 1. Let me compute this complex number.

Alternatively, maybe I can write this as 1 - z + z². Let me see if there's a way to factor this or relate it to something else. Let me try to compute 1 - z + z². Let me note that z³ - 1 = (z - 1)(z² + z + 1). Wait, but here we have 1 - z + z², which is similar to z² - z + 1. If I compare with z³ - 1 = (z - 1)(z² + z + 1), then z² - z + 1 is similar but with a different sign. Let me check:

z³ - 1 = (z - 1)(z² + z + 1). If I want to get z² - z + 1, maybe I can consider multiplying by something? Alternatively, maybe I can write z² - z + 1 = (z² + z + 1) - 2z. Not sure if that helps. Alternatively, maybe I can compute the modulus directly.

Let me compute |1 - z + z²|. Let me write this as |z² - z + 1|. Let me compute this modulus squared to make it easier. Let me denote w = z² - z + 1. Then |w|² = w * \overline{w}. Since z is on the unit circle, \overline{z} = 1/z. Therefore, \overline{w} = \overline{z²} - \overline{z} + 1 = (1/z²) - (1/z) + 1. Therefore, |w|² = (z² - z + 1)(1/z² - 1/z + 1). Let me compute this product.

First, expand the product:

(z² - z + 1)(1/z² - 1/z + 1) = z²*(1/z²) + z²*(-1/z) + z²*1 + (-z)*(1/z²) + (-z)*(-1/z) + (-z)*1 + 1*(1/z²) + 1*(-1/z) + 1*1.

Wait, that seems complicated. Maybe there's a better way. Let me note that multiplying by 1/z², but maybe I can factor or simplify.

Alternatively, let me write the expression as follows:

Let me denote A = z² - z + 1. Then, since |z| = 1, z \overline{z} = 1, so \overline{z} = 1/z. Therefore, \overline{A} = \overline{z²} - \overline{z} + 1 = (1/z²) - (1/z) + 1. Therefore, |A|² = A * \overline{A} = (z² - z + 1)(1/z² - 1/z + 1). Let me compute this:

Multiply term by term:

First term: z² * 1/z² = 1

Second term: z² * (-1/z) = -z

Third term: z² * 1 = z²

Fourth term: (-z) * 1/z² = -1/z

Fifth term: (-z) * (-1/z) = 1

Sixth term: (-z) * 1 = -z

Seventh term: 1 * 1/z² = 1/z²

Eighth term: 1 * (-1/z) = -1/z

Ninth term: 1 * 1 = 1

Now, adding all these terms together:

1 - z + z² - 1/z + 1 - z + 1/z² - 1/z + 1.

Let me combine like terms:

Constant terms: 1 + 1 + 1 = 3

Terms with z: -z - z = -2z

Terms with 1/z: -1/z -1/z = -2/z

Terms with z²: z²

Terms with 1/z²: 1/z²

So altogether:

z² + 1/z² - 2z - 2/z + 3.

Hmm, okay. Now, let me see if I can simplify this expression. Let me note that z² + 1/z² can be written as (z + 1/z)^2 - 2. Similarly, -2z - 2/z = -2(z + 1/z). Let me check:

(z + 1/z)^2 = z² + 2*(z)*(1/z) + 1/z² = z² + 2 + 1/z². Therefore, z² + 1/z² = (z + 1/z)^2 - 2. So substituting back:

(z + 1/z)^2 - 2 - 2(z + 1/z) + 3 = (z + 1/z)^2 - 2(z + 1/z) + 1.

Let me denote y = z + 1/z. Then, the expression becomes y² - 2y + 1 = (y - 1)^2. Therefore, |A|² = (y - 1)^2, so |A| = |y - 1|. But y = z + 1/z. Since z is on the unit circle, z + 1/z = 2cosθ. Wait, because z = e^(iθ), so 1/z = e^(-iθ), so z + 1/z = e^(iθ) + e^(-iθ) = 2cosθ. Therefore, y = 2cosθ. Therefore, |A| = |2cosθ - 1|. Wait, but |A|² = (y - 1)^2, so |A| = |y - 1|? Wait, no. Wait, |A|² = (y - 1)^2, so |A| = |y - 1|. But y is real? Wait, y = 2cosθ, which is real. Therefore, |A| = |2cosθ - 1|. Therefore, |1 - z + z²| = |2cosθ - 1|. Wait, is that correct? Let me check with a specific example. Let me take θ = 0. Then z = 1. Then 1 - z + z² = 1 - 1 + 1 = 1, so |1| = 1. On the other hand, 2cosθ - 1 = 2*1 - 1 = 1. So that works. Let me take θ = π. Then z = -1. Then 1 - z + z² = 1 - (-1) + 1 = 1 + 1 + 1 = 3. On the other hand, 2cosπ - 1 = 2*(-1) - 1 = -3, absolute value is 3. That works. Another example: θ = π/2. Then z = i. Then 1 - z + z² = 1 - i + (-1) = 0 - i, modulus is 1. On the other hand, 2cos(π/2) - 1 = 0 - 1 = -1, absolute value is 1. Correct. So yes, |1 - z + z²| = |2cosθ - 1|. Therefore, the second term simplifies to |2cosθ - 1|.

So putting it all together, the original expression is |1 + z| + |1 - z + z²| = 2|cos(θ/2)| + |2cosθ - 1|. Therefore, the problem reduces to finding the maximum value of 2|cos(θ/2)| + |2cosθ - 1| where θ is a real number.

Okay, so now I need to maximize this function of θ. Let me denote f(θ) = 2|cos(θ/2)| + |2cosθ - 1|. Let me think about how to approach this. Since θ is an angle, it's periodic with period 2π, so I can consider θ in [0, 2π). Also, since cos(θ/2) is involved, maybe I can make a substitution. Let me set φ = θ/2, so θ = 2φ. Then, θ ranges from 0 to 2π, so φ ranges from 0 to π. Then, f(θ) becomes 2|cosφ| + |2cos(2φ) - 1|. Let me write that:

f(φ) = 2|cosφ| + |2cos(2φ) - 1|, where φ ∈ [0, π].

This might be easier to handle. Let me note that cos(2φ) can be written in terms of cos²φ. Recall that cos(2φ) = 2cos²φ - 1. Therefore, 2cos(2φ) - 1 = 2*(2cos²φ - 1) - 1 = 4cos²φ - 2 - 1 = 4cos²φ - 3. Therefore, f(φ) becomes:

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

So now, the problem reduces to maximizing f(φ) = 2|cosφ| + |4cos²φ - 3| for φ ∈ [0, π]. Let me note that cosφ is non-negative in [0, π/2] and non-positive in [π/2, π]. However, since we have |cosφ|, maybe I can consider φ ∈ [0, π/2] and φ ∈ [π/2, π] separately, but since cosφ is symmetric around π/2? Wait, not exactly. Let me think. Alternatively, since |cosφ| is symmetric around π/2, maybe I can consider φ ∈ [0, π/2] and double it? Wait, not sure. Alternatively, since cosφ is positive in [0, π/2] and negative in [π/2, π], but |cosφ| is same as cosφ in [0, π/2] and -cosφ in [π/2, π]. However, since we have 4cos²φ - 3, which is even in cosφ, so maybe we can consider φ ∈ [0, π/2] and then mirror it? Let me check.

Let me consider φ ∈ [0, π/2]. Then cosφ ≥ 0, so |cosφ| = cosφ. Also, cos²φ is between 0 and 1. Therefore, 4cos²φ - 3 ranges from 4*0 - 3 = -3 to 4*1 - 3 = 1. Therefore, the expression inside the absolute value, 4cos²φ - 3, can be negative or positive. Let me find when 4cos²φ - 3 = 0. Solving 4cos²φ - 3 = 0 => cos²φ = 3/4 => cosφ = ±√(3)/2. Since φ ∈ [0, π/2], cosφ is positive, so cosφ = √3/2 => φ = π/6. Therefore, for φ ∈ [0, π/6], 4cos²φ - 3 ≤ 0, and for φ ∈ [π/6, π/2], 4cos²φ - 3 ≥ 0. Therefore, in [0, π/6], |4cos²φ - 3| = 3 - 4cos²φ, and in [π/6, π/2], |4cos²φ - 3| = 4cos²φ - 3. Similarly, for φ ∈ [π/2, π], cosφ is negative, so |cosφ| = -cosφ. However, cos²φ is same as in [0, π/2], so 4cos²φ - 3 is same as before. Therefore, maybe we can analyze the function in [0, π/2] and then consider the other interval?

But since the function is symmetric? Let me check. Let me take φ and π - φ. Let me compute f(π - φ). Let me compute:

cos(π - φ) = -cosφ, so |cos(π - φ)| = |cosφ|. Also, cos(2(π - φ)) = cos(2π - 2φ) = cos(2φ). Therefore, 4cos²(2(π - φ)) - 3 = 4cos²(2φ) - 3. Therefore, f(π - φ) = 2|cosφ| + |4cos²(2φ) - 3|, which is same as f(φ) if we consider φ and 2φ? Wait, no. Wait, original f(φ) is 2|cosφ| + |4cos²φ - 3|. Wait, no, in the substitution earlier, we had f(φ) = 2|cosφ| + |4cos²φ - 3|. Wait, no, hold on. Wait, earlier, we had f(φ) = 2|cosφ| + |4cos²φ - 3|. Wait, but in the substitution, we had θ = 2φ, so original expression was 2|cosφ| + |4cos²φ - 3|. Therefore, f(π - φ) would be 2|cos(π - φ)| + |4cos²(π - φ) - 3| = 2| -cosφ | + |4cos²φ - 3| = 2|cosφ| + |4cos²φ - 3| = f(φ). Therefore, f(π - φ) = f(φ). Therefore, the function is symmetric around φ = π/2. Therefore, it's sufficient to analyze φ ∈ [0, π/2], and the maximum on [π/2, π] will be same as on [0, π/2]. Therefore, I can focus on φ ∈ [0, π/2], and find the maximum there, which will be the overall maximum.

Therefore, let me focus on φ ∈ [0, π/2]. As we saw, in this interval, we can split into two cases:

Case 1: φ ∈ [0, π/6], where 4cos²φ - 3 ≤ 0, so |4cos²φ - 3| = 3 - 4cos²φ.

Case 2: φ ∈ [π/6, π/2], where 4cos²φ - 3 ≥ 0, so |4cos²φ - 3| = 4cos²φ - 3.

Therefore, f(φ) can be written as:

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

For φ ∈ [π/6, π/2]: f(φ) = 2cosφ + 4cos²φ - 3.

So now, I can analyze these two cases separately.

Let me first handle Case 1: φ ∈ [0, π/6]. Let me denote f1(φ) = 2cosφ + 3 - 4cos²φ. Let me write this as f1(φ) = -4cos²φ + 2cosφ + 3. Let me consider this as a quadratic function in terms of cosφ. Let me set x = cosφ, where x ∈ [cos(π/2), cos(0)] = [0, 1]. Wait, φ ∈ [0, π/6], so cosφ decreases from 1 to cos(π/6) = √3/2 ≈ 0.866. Therefore, x ∈ [√3/2, 1]. Wait, hold on. Wait, φ ∈ [0, π/6], so when φ increases from 0 to π/6, cosφ decreases from 1 to cos(π/6) = √3/2. Therefore, x ∈ [√3/2, 1]. Therefore, f1(x) = -4x² + 2x + 3, with x ∈ [√3/2, 1]. Let me find the maximum of this quadratic function on that interval.

Since it's a quadratic function in x, opening downward (coefficient of x² is -4 < 0), its maximum occurs at the vertex. The vertex of a quadratic ax² + bx + c is at x = -b/(2a). Here, a = -4, b = 2, so vertex at x = -2/(2*(-4)) = -2 / (-8) = 1/4. However, 1/4 is not in the interval [√3/2, 1]. Therefore, the maximum on [√3/2, 1] occurs at the left endpoint or the right endpoint. Let me compute f1 at x = √3/2 and x = 1.

First, at x = √3/2:

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

At x = 1:

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

Therefore, the maximum in this interval is √3 ≈ 1.732 at x = √3/2 (i.e., φ = π/6).

Now, moving to Case 2: φ ∈ [π/6, π/2]. Here, f(φ) = 2cosφ + 4cos²φ - 3. Let me write this as f2(φ) = 4cos²φ + 2cosφ - 3. Again, let me set x = cosφ, where φ ∈ [π/6, π/2], so x ∈ [cos(π/2), cos(π/6)] = [0, √3/2]. Therefore, x ∈ [0, √3/2]. So f2(x) = 4x² + 2x - 3. Let me analyze this quadratic function on [0, √3/2]. Since the coefficient of x² is positive (4 > 0), the parabola opens upwards, so the minimum is at the vertex and maximum at the endpoints.

The vertex is at x = -b/(2a) = -2/(2*4) = -2/8 = -1/4. Which is outside the interval [0, √3/2]. Therefore, the maximum occurs at one of the endpoints.

Compute f2 at x = 0:

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

At x = √3/2:

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

Therefore, the maximum in this interval is also √3 at x = √3/2 (i.e., φ = π/6). Wait, but φ = π/6 is the boundary between Case 1 and Case 2. Therefore, the maximum of f(φ) on [0, π/2] is √3. However, wait, but in Case 1, the maximum was √3, and in Case 2, the maximum is also √3. But is that the maximum? Wait, but maybe there's a higher value somewhere else?

Wait, but according to this, the maximum of f(φ) on [0, π/2] is √3. However, let me check if there are any critical points inside the intervals. For Case 1, the function f1(x) = -4x² + 2x + 3. Since the maximum is at the left endpoint, and the vertex is outside the interval, there are no critical points inside. Similarly, for Case 2, f2(x) = 4x² + 2x - 3, which has its vertex at x = -1/4, outside the interval, so again no critical points inside. Therefore, the maximum on [0, π/2] is √3. However, wait, but this seems low. Let me check with specific values.

For example, take φ = 0. Then f(φ) = 2*1 + |4*1 - 3| = 2 + 1 = 3. Wait, but according to our previous calculation, when φ = 0, which is in Case 1, x = 1, and f1(1) = 1. Wait, that contradicts. Wait, what's happening here?

Wait, hold on. Wait, when φ = 0, which is in Case 1 (φ ∈ [0, π/6]), then f(φ) = 2cosφ + 3 - 4cos²φ. Let me compute that:

cos(0) = 1, so f(0) = 2*1 + 3 - 4*(1)^2 = 2 + 3 - 4 = 1. But earlier, when I thought of φ = 0, I thought of the original expression. Wait, let me check again. Wait, original expression was |1 + z| + |1 - z + z²|. When φ = 0, θ = 2φ = 0, so z = e^(i*0) = 1. Then |1 + z| = |1 + 1| = 2. |1 - z + z²| = |1 - 1 + 1| = |1| = 1. Therefore, total is 2 + 1 = 3. But according to f(φ) = 2|cosφ| + |4cos²φ - 3|, when φ = 0, that would be 2*1 + |4*1 - 3| = 2 + 1 = 3. But earlier, when I computed f1(1) = -4*(1)^2 + 2*1 + 3 = -4 + 2 + 3 = 1. Wait, that's a contradiction. What's wrong here?

Ah! Wait, I think I made a mistake in splitting the cases. Let me go back. Earlier, I said that for φ ∈ [0, π/6], f(φ) = 2cosφ + 3 - 4cos²φ. But according to the substitution, f(φ) = 2|cosφ| + |4cos²φ - 3|. When φ ∈ [0, π/6], cosφ is positive, so |cosφ| = cosφ, and 4cos²φ - 3 is negative, so |4cos²φ - 3| = 3 - 4cos²φ. Therefore, f(φ) = 2cosφ + 3 - 4cos²φ. However, when φ = 0, that gives 2*1 + 3 - 4*1 = 2 + 3 - 4 = 1. But according to the original expression, it should be 3. Therefore, there's a mistake here. Where did I go wrong?

Wait, earlier, when I did the substitution, I had:

Original expression: |1 + z| + |1 - z + z²| = 2|cos(θ/2)| + |2cosθ - 1|. Then, substituting θ = 2φ, so θ/2 = φ, so 2|cosφ| + |2cos(2φ) - 1|. Then, I said that 2cos(2φ) - 1 = 4cos²φ - 3. Wait, let me check that again. cos(2φ) = 2cos²φ - 1. Therefore, 2cos(2φ) - 1 = 2*(2cos²φ - 1) - 1 = 4cos²φ - 2 - 1 = 4cos²φ - 3. Yes, that's correct. Therefore, |2cos(2φ) - 1| = |4cos²φ - 3|. Therefore, f(φ) = 2|cosφ| + |4cos²φ - 3|. Therefore, when φ = 0, f(φ) = 2*1 + |4*1 - 3| = 2 + 1 = 3. However, when I split into cases, I said for φ ∈ [0, π/6], f(φ) = 2cosφ + 3 - 4cos²φ. But when φ = 0, that gives 2*1 + 3 - 4*1 = 1, which is wrong. Therefore, my mistake was in the splitting of the cases. Wait, why?

Wait, because when I said that for φ ∈ [0, π/6], 4cos²φ - 3 ≤ 0, so |4cos²φ - 3| = 3 - 4cos²φ. Therefore, f(φ) = 2cosφ + 3 - 4cos²φ. But when φ = 0, that gives 2*1 + 3 - 4*1 = 1, but according to the original expression, it should be 3. Therefore, there's a miscalculation here. Wait, let me check again:

Original expression: f(φ) = 2|cosφ| + |4cos²φ - 3|. When φ = 0, cosφ = 1, so 4cos²φ - 3 = 4 - 3 = 1. Therefore, |4cos²φ - 3| = 1. Therefore, f(φ) = 2*1 + 1 = 3. But according to my previous expression for Case 1, which was 2cosφ + 3 - 4cos²φ, which would be 2*1 + 3 - 4*1 = 1. Therefore, there's a mistake here. Where is the error?

Ah! Wait, I think I messed up the substitution. Earlier, I said that 2cos(2φ) - 1 = 4cos²φ - 3. But then, the absolute value is |2cos(2φ) - 1| = |4cos²φ - 3|. However, when φ = 0, 2cos(2φ) - 1 = 2*1 - 1 = 1, so |1| = 1. However, according to the expression 4cos²φ - 3, when φ = 0, that is 4*1 - 3 = 1, so absolute value is 1. Therefore, that is correct. However, when I split into cases, I said that for φ ∈ [0, π/6], 4cos²φ - 3 ≤ 0. But when φ = 0, 4cos²φ - 3 = 1, which is positive. Therefore, my mistake was in determining the interval where 4cos²φ - 3 is negative. Let me re-examine that.

Earlier, I said that 4cos²φ - 3 = 0 when cosφ = ±√(3)/2. Therefore, for φ ∈ [0, π/2], cosφ is positive, so cosφ = √3/2 occurs at φ = π/6. Therefore, for φ ∈ [0, π/6], cosφ ≥ √3/2, so cos²φ ≥ 3/4, so 4cos²φ - 3 ≥ 0. Wait, that's the opposite of what I said earlier! Wait, if cosφ ≥ √3/2, then cos²φ ≥ 3/4, so 4cos²φ - 3 ≥ 0. Therefore, for φ ∈ [0, π/6], 4cos²φ - 3 ≥ 0, and for φ ∈ [π/6, π/2], cosφ ≤ √3/2, so cos²φ ≤ 3/4, so 4cos²φ - 3 ≤ 0. Therefore, my previous splitting was reversed! That explains the mistake. So I had the cases reversed. Therefore, Case 1 is φ ∈ [π/6, π/2], where 4cos²φ - 3 ≤ 0, and Case 2 is φ ∈ [0, π/6], where 4cos²φ - 3 ≥ 0. Therefore, I had the cases reversed. That was the error. Therefore, let me correct that.

So, correcting:

Case 1: φ ∈ [π/6, π/2], where 4cos²φ - 3 ≤ 0, so |4cos²φ - 3| = 3 - 4cos²φ. Therefore, f(φ) = 2cosφ + 3 - 4cos²φ.

Case 2: φ ∈ [0, π/6], where 4cos²φ - 3 ≥ 0, so |4cos²φ - 3| = 4cos²φ - 3. Therefore, f(φ) = 2cosφ + 4cos²φ - 3.

Therefore, now, let me redo the analysis.

Starting with Case 1: φ ∈ [π/6, π/2], f(φ) = 2cosφ + 3 - 4cos²φ. Let me write this as f1(φ) = -4cos²φ + 2cosφ + 3. Let me set x = cosφ, where φ ∈ [π/6, π/2], so x ∈ [0, √3/2]. Therefore, f1(x) = -4x² + 2x + 3. This is a quadratic function in x, opening downward. The vertex is at x = -b/(2a) = -2/(2*(-4)) = 1/4. Since 1/4 is in [0, √3/2] (since √3/2 ≈ 0.866 > 0.25), the maximum occurs at x = 1/4. Therefore, we need to evaluate f1 at x = 1/4, and also at the endpoints x = 0 and x = √3/2.

First, compute f1(1/4):

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

Then, compute f1(0):

f1(0) = -4*(0)^2 + 2*0 + 3 = 3.

Compute f1(√3/2):

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

Therefore, the maximum in Case 1 is 13/4 = 3.25 at x = 1/4, which corresponds to cosφ = 1/4. Therefore, φ = arccos(1/4). Let me note that arccos(1/4) is in [π/6, π/2] since 1/4 is between 0 and √3/2 ≈ 0.866. Therefore, this is valid.

Now, moving to Case 2: φ ∈ [0, π/6], f(φ) = 2cosφ + 4cos²φ - 3. Let me write this as f2(φ) = 4cos²φ + 2cosφ - 3. Let me set x = cosφ, where x ∈ [√3/2, 1]. Therefore, f2(x) = 4x² + 2x - 3. This is a quadratic function in x, opening upwards. The vertex is at x = -b/(2a) = -2/(2*4) = -1/4, which is outside the interval [√3/2, 1]. Therefore, the maximum occurs at the endpoints.

Compute f2 at x = √3/2:

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

Compute f2 at x = 1:

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

Therefore, the maximum in Case 2 is 3 at x = 1 (i.e., φ = 0).

Therefore, combining both cases, the maximum of f(φ) on [0, π/2] is 13/4 = 3.25, which occurs at φ = arccos(1/4). Therefore, since the function is symmetric around π/2, the maximum on [π/2, π] is same as on [0, π/2], so overall maximum is 13/4.

But let me check if this is correct. Let me verify with φ = arccos(1/4). Let me compute θ = 2φ. Then z = e^(iθ). Let me compute |1 + z| + |1 - z + z²|.

Alternatively, since we have already transformed the problem into f(φ) = 2|cosφ| + |4cos²φ - 3|, and found that maximum is 13/4. Let me check with φ where cosφ = 1/4. Then:

f(φ) = 2*(1/4) + |4*(1/4)^2 - 3| = 2*(1/4) + |4*(1/16) - 3| = 1/2 + |1/4 - 3| = 1/2 + | -11/4 | = 1/2 + 11/4 = 1/2 + 2.75 = 3.25 = 13/4. Correct.

But let me check with θ = 2φ. Let me compute θ. Since φ = arccos(1/4), θ = 2 arccos(1/4). Let me compute cosθ. Using double angle formula: cosθ = 2cos²φ - 1 = 2*(1/4)^2 - 1 = 2*(1/16) - 1 = 1/8 - 1 = -7/8. Therefore, cosθ = -7/8. Therefore, z = e^(iθ) has real part -7/8 and imaginary part sinθ. Let me compute |1 + z| and |1 - z + z²|.

First, compute |1 + z|. Since z = e^(iθ), 1 + z = 1 + e^(iθ). The modulus squared is |1 + z|² = (1 + cosθ)^2 + (sinθ)^2 = 1 + 2cosθ + cos²θ + sin²θ = 2 + 2cosθ. Therefore, |1 + z| = sqrt(2 + 2cosθ) = sqrt(2(1 + cosθ)). Since cosθ = -7/8, this becomes sqrt(2*(1 - 7/8)) = sqrt(2*(1/8)) = sqrt(1/4) = 1/2. Wait, but according to our previous calculation, |1 + z| = 2|cos(θ/2)|. Let me check that. Since θ = 2φ, then |1 + z| = 2|cos(θ/2)| = 2|cosφ| = 2*(1/4) = 1/2. Correct. So that matches.

Now, compute |1 - z + z²|. Earlier, we had that this is |2cosθ - 1|. Since θ is such that cosθ = -7/8, then 2cosθ - 1 = 2*(-7/8) - 1 = -14/8 - 8/8 = -22/8 = -11/4. Therefore, |2cosθ - 1| = 11/4. Therefore, total expression is |1 + z| + |1 - z + z²| = 1/2 + 11/4 = 13/4. Correct. Therefore, this checks out.

But earlier, when I thought of φ = 0, which gives θ = 0, z = 1, and the expression is 2 + 1 = 3, which is less than 13/4 = 3.25. Therefore, 13/4 is indeed larger. Therefore, the maximum value is 13/4. However, let me check if there are any other critical points or if I missed something.

Wait, but let me check another point. For example, take φ where cosφ = 0, which is φ = π/2. Then θ = π. Then z = e^(iπ) = -1. Then |1 + z| = |1 - 1| = 0. |1 - z + z²| = |1 - (-1) + 1| = |1 + 1 + 1| = 3. Therefore, total is 0 + 3 = 3, which is less than 13/4. So that's consistent.

Another test: take φ where cosφ = √3/2, which is φ = π/6. Then θ = π/3. Then z = e^(iπ/3). Compute |1 + z| = |1 + e^(iπ/3)| = 2cos(π/6) = 2*(√3/2) = √3 ≈ 1.732. |1 - z + z²|. Let me compute 1 - z + z². Since z = e^(iπ/3), z² = e^(i2π/3). Therefore, 1 - z + z² = 1 - e^(iπ/3) + e^(i2π/3). Let me compute this. Alternatively, using our previous formula, |2cosθ - 1|. θ = π/3, so 2cos(π/3) - 1 = 2*(1/2) - 1 = 1 - 1 = 0. Therefore, |0| = 0. Wait, but according to the original expression, |1 - z + z²| = 0? Let me check:

z = e^(iπ/3) = cos(π/3) + i sin(π/3) = 1/2 + i(√3/2). Then z² = e^(i2π/3) = -1/2 + i(√3/2). Therefore, 1 - z + z² = 1 - (1/2 + i√3/2) + (-1/2 + i√3/2) = 1 - 1/2 - 1/2 + i√3/2 - i√3/2 = 0. Yes, so modulus is 0. Therefore, total expression is √3 + 0 ≈ 1.732, which is less than 13/4. Therefore, that's consistent.

Therefore, the maximum seems to be 13/4. However, let me check if there are any other critical points. For example, in Case 1, we found that the maximum occurs at x = 1/4, which is cosφ = 1/4. Is there any other critical points?

In Case 1, f1(x) = -4x² + 2x + 3, which we found has maximum at x = 1/4. Since this is the only critical point in the interval [0, √3/2], and we checked endpoints, that's the maximum. Similarly, in Case 2, the maximum is at the endpoint. Therefore, the overall maximum is 13/4.

But let me check another value. Suppose φ where cosφ = 1/2, which is φ = π/3. Then θ = 2π/3. Then compute f(φ) = 2*(1/2) + |4*(1/2)^2 - 3| = 1 + |1 - 3| = 1 + 2 = 3. Which is less than 13/4 = 3.25. So that's okay.

Alternatively, take φ where cosφ = 0.25, which is the critical point. Then, as we saw, the value is 13/4. Therefore, seems correct.

But let me check if there's a higher value. For example, suppose I take φ such that cosφ = something else. Let me try to see if 13/4 is indeed the maximum.

Alternatively, maybe I can consider the function f(φ) = 2|cosφ| + |4cos²φ - 3| and analyze it over [0, π/2]. Since we have already considered the cases and found the maximum at 13/4, and verified with examples, I think that is correct.

But let me think again. The problem says |z| = 1, so z is on the unit circle. The maximum value of |1 + z| + |1 - z + z²|. We transformed it into 2|cos(θ/2)| + |2cosθ - 1|, then further into 2|cosφ| + |4cos²φ - 3|, and found maximum 13/4. Therefore, the answer should be 13/4, which is 3.25. However, let me check if there's another approach that might give a different result or confirm this.

Alternatively, maybe using geometry. Let me think. Since z is on the unit circle, maybe I can parametrize z as x + iy with x² + y² = 1. Then compute |1 + z| + |1 - z + z²|. But this might be more complicated. Alternatively, maybe using triangle inequality or other complex number properties.

Alternatively, consider that |1 + z| + |1 - z + z²|. Let me try to write 1 - z + z². Let me note that z² - z + 1. Maybe relate this to z³ + 1? Since z³ - 1 = (z - 1)(z² + z + 1). But our expression is z² - z + 1. If I multiply by z, I get z³ - z² + z. Not sure. Alternatively, maybe write z² - z + 1 = (z³ + 1)/(z + 1) if z ≠ -1. Wait, let me check:

(z³ + 1) = (z + 1)(z² - z + 1). Yes! Therefore, z² - z + 1 = (z³ + 1)/(z + 1), provided z ≠ -1. Therefore, |z² - z + 1| = |z³ + 1| / |z + 1|, if z ≠ -1. Therefore, the original expression becomes |1 + z| + |z³ + 1| / |z + 1|. But since |z + 1| is in the denominator, maybe this can be simplified?

Let me write that:

|1 + z| + |z³ + 1| / |1 + z|, if z ≠ -1. Let me denote A = |1 + z|. Then the expression is A + |z³ + 1| / A. Therefore, the expression is A + |z³ + 1| / A. Let me denote B = |z³ + 1|. Therefore, the expression is A + B/A. To maximize this, for fixed A and B, but A and B are related through z.

But since |z| = 1, z³ is also on the unit circle. Therefore, |z³ + 1| is the distance from z³ to -1 on the complex plane. Similarly, |1 + z| is the distance from z to -1. However, I don't know if this helps directly. However, maybe we can use the AM-GM inequality? For positive real numbers, A + B/A ≥ 2√(B). But since we are looking for maximum, not minimum, this might not help. Alternatively, maybe consider that for fixed A, the expression A + B/A is maximized when B is maximized. But since A and B are related, it's not straightforward.

Alternatively, since z³ is on the unit circle, |z³ + 1| ≤ |z³| + 1 = 2, by triangle inequality. Similarly, |1 + z| ≤ 2. However, this might not be helpful for finding the maximum.

Alternatively, maybe consider specific positions of z. For example, when z is such that z³ = -1, which would make |z³ + 1| = 0, but then the expression becomes |1 + z| + 0. However, if z³ = -1, then z is a cube root of -1, so z = e^(iπ + 2πik/3), k=0,1,2. For example, z = -1, which gives |1 + z| = 0, and |z³ + 1| = 0, so total expression is 0. Not helpful.

Alternatively, when z³ + 1 is maximized. The maximum of |z³ + 1| occurs when z³ is aligned with 1, i.e., z³ = 1, so z = 1, which gives |1 + 1| = 2. Therefore, in that case, the expression becomes |1 + z| + |z³ + 1| / |1 + z| = 2 + 2 / 2 = 2 + 1 = 3. Which is less than 13/4 = 3.25. Therefore, not helpful.

Alternatively, maybe consider when z is such that both terms are maximized. But since they are related, it's not straightforward.

Alternatively, going back to our previous result of 13/4, which is 3.25, which is greater than 3, so that seems better. Therefore, perhaps 13/4 is indeed the maximum.

But let me check another approach. Let me consider writing the original expression as |1 + z| + |z² - z + 1|. Let me try to find the maximum of this expression for |z| = 1.

Let me consider z = e^(iθ). Then, as before, |1 + z| = 2|cos(θ/2)|, and |z² - z + 1| = |2cosθ - 1|. Therefore, the expression is 2|cos(θ/2)| + |2cosθ - 1|. Let me consider θ in [0, 2π). Let me make substitution φ = θ/2, so θ = 2φ, φ ∈ [0, π]. Then, expression becomes 2|cosφ| + |2cos(2φ) - 1|. Which is same as before. Therefore, same analysis.

Alternatively, maybe consider specific angles. For example, suppose θ is such that cosθ = -7/8, which we had earlier. Then, 2cosθ - 1 = -11/4, absolute value 11/4. And 2|cos(θ/2)| = 1/2. Total 13/4. Alternatively, suppose θ is such that cosθ = something else. For example, suppose θ is such that cosθ = 1/2, then 2cosθ - 1 = 0, and 2|cos(θ/2)| = 2cos(θ/2). If cosθ = 1/2, then θ = π/3 or 5π/3. Then θ/2 = π/6 or 5π/6. Therefore, cos(θ/2) = √3/2 or -√3/2, absolute value √3/2. Therefore, total expression is 2*(√3/2) + 0 = √3 ≈ 1.732, which is less than 13/4.

Alternatively, suppose θ is such that cosθ = -1/2. Then 2cosθ - 1 = -2*(1/2) - 1 = -2, absolute value 2. And 2|cos(θ/2)|. Let me compute θ. If cosθ = -1/2, θ = 2π/3 or 4π/3. Then θ/2 = π/3 or 2π/3. Therefore, cos(θ/2) = 1/2 or -1/2, absolute value 1/2. Therefore, total expression is 2*(1/2) + 2 = 1 + 2 = 3, which is less than 13/4.

Alternatively, suppose θ is such that cosθ = -3/4. Then 2cosθ - 1 = -3/2 - 1 = -5/2, absolute value 5/2. Then compute 2|cos(θ/2)|. Let me compute cos(θ/2). Let me use the identity cosθ = 2cos²(θ/2) - 1. Therefore, -3/4 = 2cos²(θ/2) - 1 => 2cos²(θ/2) = 1 - 3/4 = 1/4 => cos²(θ/2) = 1/8 => cos(θ/2) = ±1/(2√2). Therefore, |cos(θ/2)| = 1/(2√2). Therefore, 2|cos(θ/2)| = 1/√2 ≈ 0.707. Therefore, total expression is 0.707 + 2.5 ≈ 3.207, which is less than 13/4 = 3.25. Therefore, close but less.

Therefore, seems like 13/4 is indeed the maximum. Therefore, I think the answer is 13/4, which is 3.25. Therefore, boxed answer is \boxed{\dfrac{13}{4}}.

**Final Answer**
\boxed{\dfrac{13}{4}}

To solve the problem, we are given a complex number $ z $ such that $ |z| = 1 $, and we are to find the **maximum value** of the expression:

$$
|1 + z| + |1 - z + z^2|
$$

---

### Step 1: Parametrize $ z $ on the Unit Circle

Since $ |z| = 1 $, we can write $ z = e^{i\theta} $, where $ \theta \in [0, 2\pi) $. This allows us to express the modulus terms in terms of trigonometric functions.

---

### Step 2: Simplify Each Term

#### First Term: $ |1 + z| $

We use the identity:
$$
|1 + e^{i\theta}| = 2|\cos(\theta/2)|
$$
This is derived from the identity:
$$
1 + e^{i\theta} = e^{i\theta/2}(2\cos(\theta/2))
$$
So,
$$
|1 + z| = 2|\cos(\theta/2)|
$$

#### Second Term: $ |1 - z + z^2| $

We simplify the expression:
$$
1 - z + z^2 = z^2 - z + 1
$$
Using the identity $ \cos(2\theta) = 2\cos^2\theta - 1 $, we can write:
$$
z^2 - z + 1 = z^2 - z + 1 = 2\cos(2\theta) - 1
$$
But since $ z = e^{i\theta} $, we have:
$$
z^2 = e^{i2\theta}, \quad \text{so} \quad z^2 - z + 1 = e^{i2\theta} - e^{i\theta} + 1
$$
This expression can be simplified to:
$$
|1 - z + z^2| = |2\cos\theta - 1|
$$

---

### Step 3: Combine the Two Terms

Now, the original expression becomes:
$$
|1 + z| + |1 - z + z^2| = 2|\cos(\theta/2)| + |2\cos\theta - 1|
$$

Let’s make a substitution to simplify further. Let:
$$
\phi = \theta/2 \Rightarrow \theta = 2\phi, \quad \text{so} \quad \cos\theta = \cos(2\phi)
$$
Then the expression becomes:
$$
f(\phi) = 2|\cos\phi| + |2\cos(2\phi) - 1|
$$

Using the identity $ \cos(2\phi) = 2\cos^2\phi - 1 $, we get:
$$
2\cos(2\phi) - 1 = 4\cos^2\phi - 3
$$
So the function becomes:
$$
f(\phi) = 2|\cos\phi| + |4\cos^2\phi - 3|
$$

---

### Step 4: Analyze the Function

We now analyze the function:
$$
f(\phi) = 2|\cos\phi| + |4\cos^2\phi - 3|, \quad \phi \in [0, \pi]
$$

Let’s define $ x = \cos\phi $, so $ x \in [-1, 1] $, and the function becomes:
$$
f(x) = 2|x| + |4x^2 - 3|
$$

We now consider the behavior of this function over the interval $ x \in [-1, 1] $.

---

### Step 5: Find the Maximum

We analyze the function in two parts based on the sign of $ 4x^2 - 3 $:

- When $ 4x^2 - 3 \geq 0 $, i.e., $ x \in [-\sqrt{3}/2, \sqrt{3}/2] $, we have:
  $$
  f(x) = 2|x| + 4x^2 - 3
  $$

- When $ 4x^2 - 3 < 0 $, i.e., $ x \in (-1, -\sqrt{3}/2) \cup (\sqrt{3}/2, 1) $, we have:
  $$
  f(x) = 2|x| + 3 - 4x^2
  $$

We now find the maximum of $ f(x) $ over $ x \in [-1, 1] $.

#### Case 1: $ x \in [-\sqrt{3}/2, \sqrt{3}/2] $

Here, $ f(x) = 2|x| + 4x^2 - 3 $

Let’s consider $ x \in [0, \sqrt{3}/2] $, since the function is even in $ x $, and we can focus on $ x \geq 0 $.

Let $ x \in [0, \sqrt{3}/2] $, then:
$$
f(x) = 2x + 4x^2 - 3
$$
This is a quadratic in $ x $, opening upwards. The maximum occurs at the endpoints.

- At $ x = 0 $: $ f(0) = 0 + 0 - 3 = -3 $
- At $ x = \sqrt{3}/2 $: $ f(\sqrt{3}/2) = 2(\sqrt{3}/2) + 4(3/4) - 3 = \sqrt{3} + 3 - 3 = \sqrt{3} \approx 1.732 $

#### Case 2: $ x \in (\sqrt{3}/2, 1] $

Here, $ f(x) = 2x + 3 - 4x^2 $

This is a quadratic in $ x $, opening downward. The maximum occurs at the vertex or endpoints.

- At $ x = \sqrt{3}/2 $: $ f(\sqrt{3}/2) = 2(\sqrt{3}/2) + 3 - 4(3/4) = \sqrt{3} + 3 - 3 = \sqrt{3} $
- At $ x = 1 $: $ f(1) = 2(1) + 3 - 4(1)^2 = 2 + 3 - 4 = 1 $

So the maximum in this interval is $ \sqrt{3} $

#### Case 3: $ x \in [-1, -\sqrt{3}/2] $

By symmetry, the function is even, so the maximum is the same as in the positive interval.

---

### Step 6: Find the Global Maximum

From the above, the maximum value of $ f(x) $ is $ \sqrt{3} \approx 1.732 $, but we also found that at $ x = 1/4 $, the function reaches a higher value.

Let’s compute $ f(1/4) $:

- $ x = 1/4 \Rightarrow |x| = 1/4 $
- $ 4x^2 - 3 = 4(1/16) - 3 = 1/4 - 3 = -11/4 \Rightarrow |4x^2 - 3| = 11/4 $

So:
$$
f(1/4) = 2(1/4) + 11/4 = 1/2 + 11/4 = 13/4 = 3.25
$$

This is the **maximum** value of the function.

---

### Final Answer

$$
\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 start by recalling that if |z| = 1, then 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. Maybe that will help me convert the problem into trigonometric terms?

Let me write z = e^(iθ). Then, I can express each modulus in terms of θ. Let me compute each part step by step.

First, compute |1 + z|. Since z = e^(iθ), then 1 + z = 1 + e^(iθ). The modulus of this is |1 + e^(iθ)|. I remember that |1 + e^(iθ)| can be simplified using the formula for the modulus of a complex number. Let me recall that |a + b|² = |a|² + |b|² + 2Re(a\overline{b}), but maybe there's a simpler way here.

Alternatively, since 1 + e^(iθ) = e^(iθ/2) * 2cos(θ/2). Wait, is that right? Let me check. Let me write 1 + e^(iθ) as e^(iθ/2)(e^(-iθ/2) + e^(iθ/2)) = e^(iθ/2) * 2cos(θ/2). Yes, that's correct. Therefore, |1 + e^(iθ)| = |2cos(θ/2)|. So |1 + z| = 2|cos(θ/2)|. Okay, that's helpful.

Now, moving on to the second term: |1 - z + z²|. Let me try to simplify this expression. Let me write it as |z² - z + 1|. Maybe I can factor this or find a way to express it in terms of θ?

Alternatively, since z is on the unit circle, z² is also on the unit circle, and so is -z. Let me try to compute this modulus. Let me write z = e^(iθ), so z² = e^(i2θ), and -z = -e^(iθ). Therefore, the expression inside the modulus is e^(i2θ) - e^(iθ) + 1. Let me compute this complex number.

Alternatively, maybe I can write this as 1 - z + z². Let me see if there's a way to factor this or relate it to something else. Let me try to compute 1 - z + z². Let me note that z³ - 1 = (z - 1)(z² + z + 1). Wait, but here we have 1 - z + z², which is similar to z² - z + 1. If I compare with z³ - 1 = (z - 1)(z² + z + 1), then z² - z + 1 is similar but with a different sign. Let me check:

z³ - 1 = (z - 1)(z² + z + 1). If I want to get z² - z + 1, maybe I can consider multiplying by something? Alternatively, maybe I can write z² - z + 1 = (z² + z + 1) - 2z. Not sure if that helps. Alternatively, maybe I can compute the modulus directly.

Let me compute |1 - z + z²|. Let me write this as |z² - z + 1|. Let me compute this modulus squared to make it easier. Let me denote w = z² - z + 1. Then |w|² = w * \overline{w}. Since z is on the unit circle, \overline{z} = 1/z. Therefore, \overline{w} = \overline{z²} - \overline{z} + 1 = (1/z²) - (1/z) + 1. Therefore, |w|² = (z² - z + 1)(1/z² - 1/z + 1). Let me compute this product.

First, expand the product:

(z² - z + 1)(1/z² - 1/z + 1) = z²*(1/z²) + z²*(-1/z) + z²*1 + (-z)*(1/z²) + (-z)*(-1/z) + (-z)*1 + 1*(1/z²) + 1*(-1/z) + 1*1.

Wait, that seems complicated. Maybe there's a better way. Let me note that multiplying by 1/z², but maybe I can factor or simplify.

Alternatively, let me write the expression as follows:

Let me denote A = z² - z + 1. Then, since |z| = 1, z \overline{z} = 1, so \overline{z} = 1/z. Therefore, \overline{A} = \overline{z²} - \overline{z} + 1 = (1/z²) - (1/z) + 1. Therefore, |A|² = A * \overline{A} = (z² - z + 1)(1/z² - 1/z + 1). Let me compute this:

Multiply term by term:

First term: z² * 1/z² = 1

Second term: z² * (-1/z) = -z

Third term: z² * 1 = z²

Fourth term: (-z) * 1/z² = -1/z

Fifth term: (-z) * (-1/z) = 1

Sixth term: (-z) * 1 = -z

Seventh term: 1 * 1/z² = 1/z²

Eighth term: 1 * (-1/z) = -1/z

Ninth term: 1 * 1 = 1

Now, adding all these terms together:

1 - z + z² - 1/z + 1 - z + 1/z² - 1/z + 1.

Let me combine like terms:

Constant terms: 1 + 1 + 1 = 3

Terms with z: -z - z = -2z

Terms with 1/z: -1/z -1/z = -2/z

Terms with z²: z²

Terms with 1/z²: 1/z²

So altogether:

z² + 1/z² - 2z - 2/z + 3.

Hmm, okay. Now, let me see if I can simplify this expression. Let me note that z² + 1/z² can be written as (z + 1/z)^2 - 2. Similarly, -2z - 2/z = -2(z + 1/z). Let me check:

(z + 1/z)^2 = z² + 2*(z)*(1/z) + 1/z² = z² + 2 + 1/z². Therefore, z² + 1/z² = (z + 1/z)^2 - 2. So substituting back:

(z + 1/z)^2 - 2 - 2(z + 1/z) + 3 = (z + 1/z)^2 - 2(z + 1/z) + 1.

Let me denote y = z + 1/z. Then, the expression becomes y² - 2y + 1 = (y - 1)^2. Therefore, |A|² = (y - 1)^2, so |A| = |y - 1|. But y = z + 1/z. Since z is on the unit circle, z + 1/z = 2cosθ. Wait, because z = e^(iθ), so 1/z = e^(-iθ), so z + 1/z = e^(iθ) + e^(-iθ) = 2cosθ. Therefore, y = 2cosθ. Therefore, |A| = |2cosθ - 1|. Wait, but |A|² = (y - 1)^2, so |A| = |y - 1|? Wait, no. Wait, |A|² = (y - 1)^2, so |A| = |y - 1|. But y is real? Wait, y = 2cosθ, which is real. Therefore, |A| = |2cosθ - 1|. Therefore, |1 - z + z²| = |2cosθ - 1|. Wait, is that correct? Let me check with a specific example. Let me take θ = 0. Then z = 1. Then 1 - z + z² = 1 - 1 + 1 = 1, so |1| = 1. On the other hand, 2cosθ - 1 = 2*1 - 1 = 1. So that works. Let me take θ = π. Then z = -1. Then 1 - z + z² = 1 - (-1) + 1 = 1 + 1 + 1 = 3. On the other hand, 2cosπ - 1 = 2*(-1) - 1 = -3, absolute value is 3. That works. Another example: θ = π/2. Then z = i. Then 1 - z + z² = 1 - i + (-1) = 0 - i, modulus is 1. On the other hand, 2cos(π/2) - 1 = 0 - 1 = -1, absolute value is 1. Correct. So yes, |1 - z + z²| = |2cosθ - 1|. Therefore, the second term simplifies to |2cosθ - 1|.

So putting it all together, the original expression is |1 + z| + |1 - z + z²| = 2|cos(θ/2)| + |2cosθ - 1|. Therefore, the problem reduces to finding the maximum value of 2|cos(θ/2)| + |2cosθ - 1| where θ is a real number.

Okay, so now I need to maximize this function of θ. Let me denote f(θ) = 2|cos(θ/2)| + |2cosθ - 1|. Let me think about how to approach this. Since θ is an angle, it's periodic with period 2π, so I can consider θ in [0, 2π). Also, since cos(θ/2) is involved, maybe I can make a substitution. Let me set φ = θ/2, so θ = 2φ. Then, θ ranges from 0 to 2π, so φ ranges from 0 to π. Then, f(θ) becomes 2|cosφ| + |2cos(2φ) - 1|. Let me write that:

f(φ) = 2|cosφ| + |2cos(2φ) - 1|, where φ ∈ [0, π].

This might be easier to handle. Let me note that cos(2φ) can be written in terms of cos²φ. Recall that cos(2φ) = 2cos²φ - 1. Therefore, 2cos(2φ) - 1 = 2*(2cos²φ - 1) - 1 = 4cos²φ - 2 - 1 = 4cos²φ - 3. Therefore, f(φ) becomes:

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

So now, the problem reduces to maximizing f(φ) = 2|cosφ| + |4cos²φ - 3| for φ ∈ [0, π]. Let me note that cosφ is non-negative in [0, π/2] and non-positive in [π/2, π]. However, since we have |cosφ|, maybe I can consider φ ∈ [0, π/2] and φ ∈ [π/2, π] separately, but since cosφ is symmetric around π/2? Wait, not exactly. Let me think. Alternatively, since |cosφ| is symmetric around π/2, maybe I can consider φ ∈ [0, π/2] and double it? Wait, not sure. Alternatively, since cosφ is positive in [0, π/2] and negative in [π/2, π], but |cosφ| is same as cosφ in [0, π/2] and -cosφ in [π/2, π]. However, since we have 4cos²φ - 3, which is even in cosφ, so maybe we can consider φ ∈ [0, π/2] and then mirror it? Let me check.

Let me consider φ ∈ [0, π/2]. Then cosφ ≥ 0, so |cosφ| = cosφ. Also, cos²φ is between 0 and 1. Therefore, 4cos²φ - 3 ranges from 4*0 - 3 = -3 to 4*1 - 3 = 1. Therefore, the expression inside the absolute value, 4cos²φ - 3, can be negative or positive. Let me find when 4cos²φ - 3 = 0. Solving 4cos²φ - 3 = 0 => cos²φ = 3/4 => cosφ = ±√(3)/2. Since φ ∈ [0, π/2], cosφ is positive, so cosφ = √3/2 => φ = π/6. Therefore, for φ ∈ [0, π/6], 4cos²φ - 3 ≤ 0, and for φ ∈ [π/6, π/2], 4cos²φ - 3 ≥ 0. Therefore, in [0, π/6], |4cos²φ - 3| = 3 - 4cos²φ, and in [π/6, π/2], |4cos²φ - 3| = 4cos²φ - 3. Similarly, for φ ∈ [π/2, π], cosφ is negative, so |cosφ| = -cosφ. However, cos²φ is same as in [0, π/2], so 4cos²φ - 3 is same as before. Therefore, maybe we can analyze the function in [0, π/2] and then consider the other interval?

But since the function is symmetric? Let me check. Let me take φ and π - φ. Let me compute f(π - φ). Let me compute:

cos(π - φ) = -cosφ, so |cos(π - φ)| = |cosφ|. Also, cos(2(π - φ)) = cos(2π - 2φ) = cos(2φ). Therefore, 4cos²(2(π - φ)) - 3 = 4cos²(2φ) - 3. Therefore, f(π - φ) = 2|cosφ| + |4cos²(2φ) - 3|, which is same as f(φ) if we consider φ and 2φ? Wait, no. Wait, original f(φ) is 2|cosφ| + |4cos²φ - 3|. Wait, no, in the substitution earlier, we had f(φ) = 2|cosφ| + |4cos²φ - 3|. Wait, no, hold on. Wait, earlier, we had f(φ) = 2|cosφ| + |4cos²φ - 3|. Wait, but in the substitution, we had θ = 2φ, so original expression was 2|cosφ| + |4cos²φ - 3|. Therefore, f(π - φ) would be 2|cos(π - φ)| + |4cos²(π - φ) - 3| = 2| -cosφ | + |4cos²φ - 3| = 2|cosφ| + |4cos²φ - 3| = f(φ). Therefore, f(π - φ) = f(φ). Therefore, the function is symmetric around φ = π/2. Therefore, it's sufficient to analyze φ ∈ [0, π/2], and the maximum on [π/2, π] will be same as on [0, π/2]. Therefore, I can focus on φ ∈ [0, π/2], and find the maximum there, which will be the overall maximum.

Therefore, let me focus on φ ∈ [0, π/2]. As we saw, in this interval, we can split into two cases:

Case 1: φ ∈ [0, π/6], where 4cos²φ - 3 ≤ 0, so |4cos²φ - 3| = 3 - 4cos²φ.

Case 2: φ ∈ [π/6, π/2], where 4cos²φ - 3 ≥ 0, so |4cos²φ - 3| = 4cos²φ - 3.

Therefore, f(φ) can be written as:

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

For φ ∈ [π/6, π/2]: f(φ) = 2cosφ + 4cos²φ - 3.

So now, I can analyze these two cases separately.

Let me first handle Case 1: φ ∈ [0, π/6]. Let me denote f1(φ) = 2cosφ + 3 - 4cos²φ. Let me write this as f1(φ) = -4cos²φ + 2cosφ + 3. Let me consider this as a quadratic function in terms of cosφ. Let me set x = cosφ, where x ∈ [cos(π/2), cos(0)] = [0, 1]. Wait, φ ∈ [0, π/6], so cosφ decreases from 1 to cos(π/6) = √3/2 ≈ 0.866. Therefore, x ∈ [√3/2, 1]. Wait, hold on. Wait, φ ∈ [0, π/6], so when φ increases from 0 to π/6, cosφ decreases from 1 to cos(π/6) = √3/2. Therefore, x ∈ [√3/2, 1]. Therefore, f1(x) = -4x² + 2x + 3, with x ∈ [√3/2, 1]. Let me find the maximum of this quadratic function on that interval.

Since it's a quadratic function in x, opening downward (coefficient of x² is -4 < 0), its maximum occurs at the vertex. The vertex of a quadratic ax² + bx + c is at x = -b/(2a). Here, a = -4, b = 2, so vertex at x = -2/(2*(-4)) = -2 / (-8) = 1/4. However, 1/4 is not in the interval [√3/2, 1]. Therefore, the maximum on [√3/2, 1] occurs at the left endpoint or the right endpoint. Let me compute f1 at x = √3/2 and x = 1.

First, at x = √3/2:

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

At x = 1:

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

Therefore, the maximum in this interval is √3 ≈ 1.732 at x = √3/2 (i.e., φ = π/6).

Now, moving to Case 2: φ ∈ [π/6, π/2]. Here, f(φ) = 2cosφ + 4cos²φ - 3. Let me write this as f2(φ) = 4cos²φ + 2cosφ - 3. Again, let me set x = cosφ, where φ ∈ [π/6, π/2], so x ∈ [cos(π/2), cos(π/6)] = [0, √3/2]. Therefore, x ∈ [0, √3/2]. So f2(x) = 4x² + 2x - 3. Let me analyze this quadratic function on [0, √3/2]. Since the coefficient of x² is positive (4 > 0), the parabola opens upwards, so the minimum is at the vertex and maximum at the endpoints.

The vertex is at x = -b/(2a) = -2/(2*4) = -2/8 = -1/4. Which is outside the interval [0, √3/2]. Therefore, the maximum occurs at one of the endpoints.

Compute f2 at x = 0:

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

At x = √3/2:

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

Therefore, the maximum in this interval is also √3 at x = √3/2 (i.e., φ = π/6). Wait, but φ = π/6 is the boundary between Case 1 and Case 2. Therefore, the maximum of f(φ) on [0, π/2] is √3. However, wait, but in Case 1, the maximum was √3, and in Case 2, the maximum is also √3. But is that the maximum? Wait, but maybe there's a higher value somewhere else?

Wait, but according to this, the maximum of f(φ) on [0, π/2] is √3. However, let me check if there are any critical points inside the intervals. For Case 1, the function f1(x) = -4x² + 2x + 3. Since the maximum is at the left endpoint, and the vertex is outside the interval, there are no critical points inside. Similarly, for Case 2, f2(x) = 4x² + 2x - 3, which has its vertex at x = -1/4, outside the interval, so again no critical points inside. Therefore, the maximum on [0, π/2] is √3. However, wait, but this seems low. Let me check with specific values.

For example, take φ = 0. Then f(φ) = 2*1 + |4*1 - 3| = 2 + 1 = 3. Wait, but according to our previous calculation, when φ = 0, which is in Case 1, x = 1, and f1(1) = 1. Wait, that contradicts. Wait, what's happening here?

Wait, hold on. Wait, when φ = 0, which is in Case 1 (φ ∈ [0, π/6]), then f(φ) = 2cosφ + 3 - 4cos²φ. Let me compute that:

cos(0) = 1, so f(0) = 2*1 + 3 - 4*(1)^2 = 2 + 3 - 4 = 1. But earlier, when I thought of φ = 0, I thought of the original expression. Wait, let me check again. Wait, original expression was |1 + z| + |1 - z + z²|. When φ = 0, θ = 2φ = 0, so z = e^(i*0) = 1. Then |1 + z| = |1 + 1| = 2. |1 - z + z²| = |1 - 1 + 1| = |1| = 1. Therefore, total is 2 + 1 = 3. But according to f(φ) = 2|cosφ| + |4cos²φ - 3|, when φ = 0, that would be 2*1 + |4*1 - 3| = 2 + 1 = 3. But earlier, when I computed f1(1) = -4*(1)^2 + 2*1 + 3 = -4 + 2 + 3 = 1. Wait, that's a contradiction. What's wrong here?

Ah! Wait, I think I made a mistake in splitting the cases. Let me go back. Earlier, I said that for φ ∈ [0, π/6], f(φ) = 2cosφ + 3 - 4cos²φ. But according to the substitution, f(φ) = 2|cosφ| + |4cos²φ - 3|. When φ ∈ [0, π/6], cosφ is positive, so |cosφ| = cosφ, and 4cos²φ - 3 is negative, so |4cos²φ - 3| = 3 - 4cos²φ. Therefore, f(φ) = 2cosφ + 3 - 4cos²φ. However, when φ = 0, that gives 2*1 + 3 - 4*1 = 2 + 3 - 4 = 1. But according to the original expression, it should be 3. Therefore, there's a mistake here. Where did I go wrong?

Wait, earlier, when I did the substitution, I had:

Original expression: |1 + z| + |1 - z + z²| = 2|cos(θ/2)| + |2cosθ - 1|. Then, substituting θ = 2φ, so θ/2 = φ, so 2|cosφ| + |2cos(2φ) - 1|. Then, I said that 2cos(2φ) - 1 = 4cos²φ - 3. Wait, let me check that again. cos(2φ) = 2cos²φ - 1. Therefore, 2cos(2φ) - 1 = 2*(2cos²φ - 1) - 1 = 4cos²φ - 2 - 1 = 4cos²φ - 3. Yes, that's correct. Therefore, |2cos(2φ) - 1| = |4cos²φ - 3|. Therefore, f(φ) = 2|cosφ| + |4cos²φ - 3|. Therefore, when φ = 0, f(φ) = 2*1 + |4*1 - 3| = 2 + 1 = 3. However, when I split into cases, I said for φ ∈ [0, π/6], f(φ) = 2cosφ + 3 - 4cos²φ. But when φ = 0, that gives 2*1 + 3 - 4*1 = 1, which is wrong. Therefore, my mistake was in the splitting of the cases. Wait, why?

Wait, because when I said that for φ ∈ [0, π/6], 4cos²φ - 3 ≤ 0, so |4cos²φ - 3| = 3 - 4cos²φ. Therefore, f(φ) = 2cosφ + 3 - 4cos²φ. But when φ = 0, that gives 2*1 + 3 - 4*1 = 1, but according to the original expression, it should be 3. Therefore, there's a miscalculation here. Wait, let me check again:

Original expression: f(φ) = 2|cosφ| + |4cos²φ - 3|. When φ = 0, cosφ = 1, so 4cos²φ - 3 = 4 - 3 = 1. Therefore, |4cos²φ - 3| = 1. Therefore, f(φ) = 2*1 + 1 = 3. But according to my previous expression for Case 1, which was 2cosφ + 3 - 4cos²φ, which would be 2*1 + 3 - 4*1 = 1. Therefore, there's a mistake here. Where is the error?

Ah! Wait, I think I messed up the substitution. Earlier, I said that 2cos(2φ) - 1 = 4cos²φ - 3. But then, the absolute value is |2cos(2φ) - 1| = |4cos²φ - 3|. However, when φ = 0, 2cos(2φ) - 1 = 2*1 - 1 = 1, so |1| = 1. However, according to the expression 4cos²φ - 3, when φ = 0, that is 4*1 - 3 = 1, so absolute value is 1. Therefore, that is correct. However, when I split into cases, I said that for φ ∈ [0, π/6], 4cos²φ - 3 ≤ 0. But when φ = 0, 4cos²φ - 3 = 1, which is positive. Therefore, my mistake was in determining the interval where 4cos²φ - 3 is negative. Let me re-examine that.

Earlier, I said that 4cos²φ - 3 = 0 when cosφ = ±√(3)/2. Therefore, for φ ∈ [0, π/2], cosφ is positive, so cosφ = √3/2 occurs at φ = π/6. Therefore, for φ ∈ [0, π/6], cosφ ≥ √3/2, so cos²φ ≥ 3/4, so 4cos²φ - 3 ≥ 0. Wait, that's the opposite of what I said earlier! Wait, if cosφ ≥ √3/2, then cos²φ ≥ 3/4, so 4cos²φ - 3 ≥ 0. Therefore, for φ ∈ [0, π/6], 4cos²φ - 3 ≥ 0, and for φ ∈ [π/6, π/2], cosφ ≤ √3/2, so cos²φ ≤ 3/4, so 4cos²φ - 3 ≤ 0. Therefore, my previous splitting was reversed! That explains the mistake. So I had the cases reversed. Therefore, Case 1 is φ ∈ [π/6, π/2], where 4cos²φ - 3 ≤ 0, and Case 2 is φ ∈ [0, π/6], where 4cos²φ - 3 ≥ 0. Therefore, I had the cases reversed. That was the error. Therefore, let me correct that.

So, correcting:

Case 1: φ ∈ [π/6, π/2], where 4cos²φ - 3 ≤ 0, so |4cos²φ - 3| = 3 - 4cos²φ. Therefore, f(φ) = 2cosφ + 3 - 4cos²φ.

Case 2: φ ∈ [0, π/6], where 4cos²φ - 3 ≥ 0, so |4cos²φ - 3| = 4cos²φ - 3. Therefore, f(φ) = 2cosφ + 4cos²φ - 3.

Therefore, now, let me redo the analysis.

Starting with Case 1: φ ∈ [π/6, π/2], f(φ) = 2cosφ + 3 - 4cos²φ. Let me write this as f1(φ) = -4cos²φ + 2cosφ + 3. Let me set x = cosφ, where φ ∈ [π/6, π/2], so x ∈ [0, √3/2]. Therefore, f1(x) = -4x² + 2x + 3. This is a quadratic function in x, opening downward. The vertex is at x = -b/(2a) = -2/(2*(-4)) = 1/4. Since 1/4 is in [0, √3/2] (since √3/2 ≈ 0.866 > 0.25), the maximum occurs at x = 1/4. Therefore, we need to evaluate f1 at x = 1/4, and also at the endpoints x = 0 and x = √3/2.

First, compute f1(1/4):

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

Then, compute f1(0):

f1(0) = -4*(0)^2 + 2*0 + 3 = 3.

Compute f1(√3/2):

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

Therefore, the maximum in Case 1 is 13/4 = 3.25 at x = 1/4, which corresponds to cosφ = 1/4. Therefore, φ = arccos(1/4). Let me note that arccos(1/4) is in [π/6, π/2] since 1/4 is between 0 and √3/2 ≈ 0.866. Therefore, this is valid.

Now, moving to Case 2: φ ∈ [0, π/6], f(φ) = 2cosφ + 4cos²φ - 3. Let me write this as f2(φ) = 4cos²φ + 2cosφ - 3. Let me set x = cosφ, where x ∈ [√3/2, 1]. Therefore, f2(x) = 4x² + 2x - 3. This is a quadratic function in x, opening upwards. The vertex is at x = -b/(2a) = -2/(2*4) = -1/4, which is outside the interval [√3/2, 1]. Therefore, the maximum occurs at the endpoints.

Compute f2 at x = √3/2:

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

Compute f2 at x = 1:

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

Therefore, the maximum in Case 2 is 3 at x = 1 (i.e., φ = 0).

Therefore, combining both cases, the maximum of f(φ) on [0, π/2] is 13/4 = 3.25, which occurs at φ = arccos(1/4). Therefore, since the function is symmetric around π/2, the maximum on [π/2, π] is same as on [0, π/2], so overall maximum is 13/4.

But let me check if this is correct. Let me verify with φ = arccos(1/4). Let me compute θ = 2φ. Then z = e^(iθ). Let me compute |1 + z| + |1 - z + z²|.

Alternatively, since we have already transformed the problem into f(φ) = 2|cosφ| + |4cos²φ - 3|, and found that maximum is 13/4. Let me check with φ where cosφ = 1/4. Then:

f(φ) = 2*(1/4) + |4*(1/4)^2 - 3| = 2*(1/4) + |4*(1/16) - 3| = 1/2 + |1/4 - 3| = 1/2 + | -11/4 | = 1/2 + 11/4 = 1/2 + 2.75 = 3.25 = 13/4. Correct.

But let me check with θ = 2φ. Let me compute θ. Since φ = arccos(1/4), θ = 2 arccos(1/4). Let me compute cosθ. Using double angle formula: cosθ = 2cos²φ - 1 = 2*(1/4)^2 - 1 = 2*(1/16) - 1 = 1/8 - 1 = -7/8. Therefore, cosθ = -7/8. Therefore, z = e^(iθ) has real part -7/8 and imaginary part sinθ. Let me compute |1 + z| and |1 - z + z²|.

First, compute |1 + z|. Since z = e^(iθ), 1 + z = 1 + e^(iθ). The modulus squared is |1 + z|² = (1 + cosθ)^2 + (sinθ)^2 = 1 + 2cosθ + cos²θ + sin²θ = 2 + 2cosθ. Therefore, |1 + z| = sqrt(2 + 2cosθ) = sqrt(2(1 + cosθ)). Since cosθ = -7/8, this becomes sqrt(2*(1 - 7/8)) = sqrt(2*(1/8)) = sqrt(1/4) = 1/2. Wait, but according to our previous calculation, |1 + z| = 2|cos(θ/2)|. Let me check that. Since θ = 2φ, then |1 + z| = 2|cos(θ/2)| = 2|cosφ| = 2*(1/4) = 1/2. Correct. So that matches.

Now, compute |1 - z + z²|. Earlier, we had that this is |2cosθ - 1|. Since θ is such that cosθ = -7/8, then 2cosθ - 1 = 2*(-7/8) - 1 = -14/8 - 8/8 = -22/8 = -11/4. Therefore, |2cosθ - 1| = 11/4. Therefore, total expression is |1 + z| + |1 - z + z²| = 1/2 + 11/4 = 13/4. Correct. Therefore, this checks out.

But earlier, when I thought of φ = 0, which gives θ = 0, z = 1, and the expression is 2 + 1 = 3, which is less than 13/4 = 3.25. Therefore, 13/4 is indeed larger. Therefore, the maximum value is 13/4. However, let me check if there are any other critical points or if I missed something.

Wait, but let me check another point. For example, take φ where cosφ = 0, which is φ = π/2. Then θ = π. Then z = e^(iπ) = -1. Then |1 + z| = |1 - 1| = 0. |1 - z + z²| = |1 - (-1) + 1| = |1 + 1 + 1| = 3. Therefore, total is 0 + 3 = 3, which is less than 13/4. So that's consistent.

Another test: take φ where cosφ = √3/2, which is φ = π/6. Then θ = π/3. Then z = e^(iπ/3). Compute |1 + z| = |1 + e^(iπ/3)| = 2cos(π/6) = 2*(√3/2) = √3 ≈ 1.732. |1 - z + z²|. Let me compute 1 - z + z². Since z = e^(iπ/3), z² = e^(i2π/3). Therefore, 1 - z + z² = 1 - e^(iπ/3) + e^(i2π/3). Let me compute this. Alternatively, using our previous formula, |2cosθ - 1|. θ = π/3, so 2cos(π/3) - 1 = 2*(1/2) - 1 = 1 - 1 = 0. Therefore, |0| = 0. Wait, but according to the original expression, |1 - z + z²| = 0? Let me check:

z = e^(iπ/3) = cos(π/3) + i sin(π/3) = 1/2 + i(√3/2). Then z² = e^(i2π/3) = -1/2 + i(√3/2). Therefore, 1 - z + z² = 1 - (1/2 + i√3/2) + (-1/2 + i√3/2) = 1 - 1/2 - 1/2 + i√3/2 - i√3/2 = 0. Yes, so modulus is 0. Therefore, total expression is √3 + 0 ≈ 1.732, which is less than 13/4. Therefore, that's consistent.

Therefore, the maximum seems to be 13/4. However, let me check if there are any other critical points. For example, in Case 1, we found that the maximum occurs at x = 1/4, which is cosφ = 1/4. Is there any other critical points?

In Case 1, f1(x) = -4x² + 2x + 3, which we found has maximum at x = 1/4. Since this is the only critical point in the interval [0, √3/2], and we checked endpoints, that's the maximum. Similarly, in Case 2, the maximum is at the endpoint. Therefore, the overall maximum is 13/4.

But let me check another value. Suppose φ where cosφ = 1/2, which is φ = π/3. Then θ = 2π/3. Then compute f(φ) = 2*(1/2) + |4*(1/2)^2 - 3| = 1 + |1 - 3| = 1 + 2 = 3. Which is less than 13/4 = 3.25. So that's okay.

Alternatively, take φ where cosφ = 0.25, which is the critical point. Then, as we saw, the value is 13/4. Therefore, seems correct.

But let me check if there's a higher value. For example, suppose I take φ such that cosφ = something else. Let me try to see if 13/4 is indeed the maximum.

Alternatively, maybe I can consider the function f(φ) = 2|cosφ| + |4cos²φ - 3| and analyze it over [0, π/2]. Since we have already considered the cases and found the maximum at 13/4, and verified with examples, I think that is correct.

But let me think again. The problem says |z| = 1, so z is on the unit circle. The maximum value of |1 + z| + |1 - z + z²|. We transformed it into 2|cos(θ/2)| + |2cosθ - 1|, then further into 2|cosφ| + |4cos²φ - 3|, and found maximum 13/4. Therefore, the answer should be 13/4, which is 3.25. However, let me check if there's another approach that might give a different result or confirm this.

Alternatively, maybe using geometry. Let me think. Since z is on the unit circle, maybe I can parametrize z as x + iy with x² + y² = 1. Then compute |1 + z| + |1 - z + z²|. But this might be more complicated. Alternatively, maybe using triangle inequality or other complex number properties.

Alternatively, consider that |1 + z| + |1 - z + z²|. Let me try to write 1 - z + z². Let me note that z² - z + 1. Maybe relate this to z³ + 1? Since z³ - 1 = (z - 1)(z² + z + 1). But our expression is z² - z + 1. If I multiply by z, I get z³ - z² + z. Not sure. Alternatively, maybe write z² - z + 1 = (z³ + 1)/(z + 1) if z ≠ -1. Wait, let me check:

(z³ + 1) = (z + 1)(z² - z + 1). Yes! Therefore, z² - z + 1 = (z³ + 1)/(z + 1), provided z ≠ -1. Therefore, |z² - z + 1| = |z³ + 1| / |z + 1|, if z ≠ -1. Therefore, the original expression becomes |1 + z| + |z³ + 1| / |z + 1|. But since |z + 1| is in the denominator, maybe this can be simplified?

Let me write that:

|1 + z| + |z³ + 1| / |1 + z|, if z ≠ -1. Let me denote A = |1 + z|. Then the expression is A + |z³ + 1| / A. Therefore, the expression is A + |z³ + 1| / A. Let me denote B = |z³ + 1|. Therefore, the expression is A + B/A. To maximize this, for fixed A and B, but A and B are related through z.

But since |z| = 1, z³ is also on the unit circle. Therefore, |z³ + 1| is the distance from z³ to -1 on the complex plane. Similarly, |1 + z| is the distance from z to -1. However, I don't know if this helps directly. However, maybe we can use the AM-GM inequality? For positive real numbers, A + B/A ≥ 2√(B). But since we are looking for maximum, not minimum, this might not help. Alternatively, maybe consider that for fixed A, the expression A + B/A is maximized when B is maximized. But since A and B are related, it's not straightforward.

Alternatively, since z³ is on the unit circle, |z³ + 1| ≤ |z³| + 1 = 2, by triangle inequality. Similarly, |1 + z| ≤ 2. However, this might not be helpful for finding the maximum.

Alternatively, maybe consider specific positions of z. For example, when z is such that z³ = -1, which would make |z³ + 1| = 0, but then the expression becomes |1 + z| + 0. However, if z³ = -1, then z is a cube root of -1, so z = e^(iπ + 2πik/3), k=0,1,2. For example, z = -1, which gives |1 + z| = 0, and |z³ + 1| = 0, so total expression is 0. Not helpful.

Alternatively, when z³ + 1 is maximized. The maximum of |z³ + 1| occurs when z³ is aligned with 1, i.e., z³ = 1, so z = 1, which gives |1 + 1| = 2. Therefore, in that case, the expression becomes |1 + z| + |z³ + 1| / |1 + z| = 2 + 2 / 2 = 2 + 1 = 3. Which is less than 13/4 = 3.25. Therefore, not helpful.

Alternatively, maybe consider when z is such that both terms are maximized. But since they are related, it's not straightforward.

Alternatively, going back to our previous result of 13/4, which is 3.25, which is greater than 3, so that seems better. Therefore, perhaps 13/4 is indeed the maximum.

But let me check another approach. Let me consider writing the original expression as |1 + z| + |z² - z + 1|. Let me try to find the maximum of this expression for |z| = 1.

Let me consider z = e^(iθ). Then, as before, |1 + z| = 2|cos(θ/2)|, and |z² - z + 1| = |2cosθ - 1|. Therefore, the expression is 2|cos(θ/2)| + |2cosθ - 1|. Let me consider θ in [0, 2π). Let me make substitution φ = θ/2, so θ = 2φ, φ ∈ [0, π]. Then, expression becomes 2|cosφ| + |2cos(2φ) - 1|. Which is same as before. Therefore, same analysis.

Alternatively, maybe consider specific angles. For example, suppose θ is such that cosθ = -7/8, which we had earlier. Then, 2cosθ - 1 = -11/4, absolute value 11/4. And 2|cos(θ/2)| = 1/2. Total 13/4. Alternatively, suppose θ is such that cosθ = something else. For example, suppose θ is such that cosθ = 1/2, then 2cosθ - 1 = 0, and 2|cos(θ/2)| = 2cos(θ/2). If cosθ = 1/2, then θ = π/3 or 5π/3. Then θ/2 = π/6 or 5π/6. Therefore, cos(θ/2) = √3/2 or -√3/2, absolute value √3/2. Therefore, total expression is 2*(√3/2) + 0 = √3 ≈ 1.732, which is less than 13/4.

Alternatively, suppose θ is such that cosθ = -1/2. Then 2cosθ - 1 = -2*(1/2) - 1 = -2, absolute value 2. And 2|cos(θ/2)|. Let me compute θ. If cosθ = -1/2, θ = 2π/3 or 4π/3. Then θ/2 = π/3 or 2π/3. Therefore, cos(θ/2) = 1/2 or -1/2, absolute value 1/2. Therefore, total expression is 2*(1/2) + 2 = 1 + 2 = 3, which is less than 13/4.

Alternatively, suppose θ is such that cosθ = -3/4. Then 2cosθ - 1 = -3/2 - 1 = -5/2, absolute value 5/2. Then compute 2|cos(θ/2)|. Let me compute cos(θ/2). Let me use the identity cosθ = 2cos²(θ/2) - 1. Therefore, -3/4 = 2cos²(θ/2) - 1 => 2cos²(θ/2) = 1 - 3/4 = 1/4 => cos²(θ/2) = 1/8 => cos(θ/2) = ±1/(2√2). Therefore, |cos(θ/2)| = 1/(2√2). Therefore, 2|cos(θ/2)| = 1/√2 ≈ 0.707. Therefore, total expression is 0.707 + 2.5 ≈ 3.207, which is less than 13/4 = 3.25. Therefore, close but less.

Therefore, seems like 13/4 is indeed the maximum. Therefore, I think the answer is 13/4, which is 3.25. Therefore, boxed answer is \boxed{\dfrac{13}{4}}.

**Final Answer**
\boxed{\dfrac{13}{4}}

To solve the problem, we are given a complex number $ z $ such that $ |z| = 1 $, and we are to find the **maximum value** of the expression:

$$
|1 + z| + |1 - z + z^2|
$$

---

### Step 1: Parametrize $ z $ on the Unit Circle

Since $ |z| = 1 $, we can write $ z = e^{i\theta} $, where $ \theta \in [0, 2\pi) $. This allows us to express the modulus terms in terms of trigonometric functions.

---

### Step 2: Simplify Each Term

#### First Term: $ |1 + z| $

We use the identity:
$$
|1 + e^{i\theta}| = 2|\cos(\theta/2)|
$$
This is derived from the identity:
$$
1 + e^{i\theta} = e^{i\theta/2}(2\cos(\theta/2))
$$
So,
$$
|1 + z| = 2|\cos(\theta/2)|
$$

#### Second Term: $ |1 - z + z^2| $

We simplify the expression:
$$
1 - z + z^2 = z^2 - z + 1
$$
Using the identity $ \cos(2\theta) = 2\cos^2\theta - 1 $, we can write:
$$
z^2 - z + 1 = z^2 - z + 1 = 2\cos(2\theta) - 1
$$
But since $ z = e^{i\theta} $, we have:
$$
z^2 = e^{i2\theta}, \quad \text{so} \quad z^2 - z + 1 = e^{i2\theta} - e^{i\theta} + 1
$$
This expression can be simplified to:
$$
|1 - z + z^2| = |2\cos\theta - 1|
$$

---

### Step 3: Combine the Two Terms

Now, the original expression becomes:
$$
|1 + z| + |1 - z + z^2| = 2|\cos(\theta/2)| + |2\cos\theta - 1|
$$

Let’s make a substitution to simplify further. Let:
$$
\phi = \theta/2 \Rightarrow \theta = 2\phi, \quad \text{so} \quad \cos\theta = \cos(2\phi)
$$
Then the expression becomes:
$$
f(\phi) = 2|\cos\phi| + |2\cos(2\phi) - 1|
$$

Using the identity $ \cos(2\phi) = 2\cos^2\phi - 1 $, we get:
$$
2\cos(2\phi) - 1 = 4\cos^2\phi - 3
$$
So the function becomes:
$$
f(\phi) = 2|\cos\phi| + |4\cos^2\phi - 3|
$$

---

### Step 4: Analyze the Function

We now analyze the function:
$$
f(\phi) = 2|\cos\phi| + |4\cos^2\phi - 3|, \quad \phi \in [0, \pi]
$$

Let’s define $ x = \cos\phi $, so $ x \in [-1, 1] $, and the function becomes:
$$
f(x) = 2|x| + |4x^2 - 3|
$$

We now consider the behavior of this function over the interval $ x \in [-1, 1] $.

---

### Step 5: Find the Maximum

We analyze the function in two parts based on the sign of $ 4x^2 - 3 $:

- When $ 4x^2 - 3 \geq 0 $, i.e., $ x \in [-\sqrt{3}/2, \sqrt{3}/2] $, we have:
  $$
  f(x) = 2|x| + 4x^2 - 3
  $$

- When $ 4x^2 - 3 < 0 $, i.e., $ x \in (-1, -\sqrt{3}/2) \cup (\sqrt{3}/2, 1) $, we have:
  $$
  f(x) = 2|x| + 3 - 4x^2
  $$

We now find the maximum of $ f(x) $ over $ x \in [-1, 1] $.

#### Case 1: $ x \in [-\sqrt{3}/2, \sqrt{3}/2] $

Here, $ f(x) = 2|x| + 4x^2 - 3 $

Let’s consider $ x \in [0, \sqrt{3}/2] $, since the function is even in $ x $, and we can focus on $ x \geq 0 $.

Let $ x \in [0, \sqrt{3}/2] $, then:
$$
f(x) = 2x + 4x^2 - 3
$$
This is a quadratic in $ x $, opening upwards. The maximum occurs at the endpoints.

- At $ x = 0 $: $ f(0) = 0 + 0 - 3 = -3 $
- At $ x = \sqrt{3}/2 $: $ f(\sqrt{3}/2) = 2(\sqrt{3}/2) + 4(3/4) - 3 = \sqrt{3} + 3 - 3 = \sqrt{3} \approx 1.732 $

#### Case 2: $ x \in (\sqrt{3}/2, 1] $

Here, $ f(x) = 2x + 3 - 4x^2 $

This is a quadratic in $ x $, opening downward. The maximum occurs at the vertex or endpoints.

- At $ x = \sqrt{3}/2 $: $ f(\sqrt{3}/2) = 2(\sqrt{3}/2) + 3 - 4(3/4) = \sqrt{3} + 3 - 3 = \sqrt{3} $
- At $ x = 1 $: $ f(1) = 2(1) + 3 - 4(1)^2 = 2 + 3 - 4 = 1 $

So the maximum in this interval is $ \sqrt{3} $

#### Case 3: $ x \in [-1, -\sqrt{3}/2] $

By symmetry, the function is even, so the maximum is the same as in the positive interval.

---

### Step 6: Find the Global Maximum

From the above, the maximum value of $ f(x) $ is $ \sqrt{3} \approx 1.732 $, but we also found that at $ x = 1/4 $, the function reaches a higher value.

Let’s compute $ f(1/4) $:

- $ x = 1/4 \Rightarrow |x| = 1/4 $
- $ 4x^2 - 3 = 4(1/16) - 3 = 1/4 - 3 = -11/4 \Rightarrow |4x^2 - 3| = 11/4 $

So:
$$
f(1/4) = 2(1/4) + 11/4 = 1/2 + 11/4 = 13/4 = 3.25
$$

This is the **maximum** value of the function.

---

### Final Answer

$$
\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}}.$