The question is:
If the tangent line to the curve $y=e^x+x$ at point $(0,1)$ is also a tangent line to the curve $y=\ln(x+1)+a$, then $a=$ _______
My method is like this, very cumbersome!
Clear["`*"]
f[x_] = E^x + x;
pt = {0, 1}; k1 = f' /. x -> pt[[1]]
line = y - 1 == k1 x // Simplify
g[x_] = Log[x + 1] + a
k2 = D[g[x], x]
sol = Reduce[{k1 == k2}, x] // ToRules
sol1 = Reduce[line /. sol, y] // ToRules
pt1 = {x, y} /. Thread[{x, y} -> {sol // Values, sol1 // Values}] //
Flatten[#, 1] &
Reduce[{y == Log[x + 1] + a, x == pt1[[1]], y == pt1[[2]]}, a]
This problem does not require drawing, just calculate the results of the corresponding parameters.
Is there a more concise method to solve the problem?
Reduce[{1/(1 + x) == 2, Log[x + 1] + a == 2 x + 1}, a]
with this plot:Manipulate[ Plot[{f1[x], 2 x + 1, Log[x + 1] + a}, {x, -1, 1}, AspectRatio -> Automatic, PlotRange -> 2], {{a, 0}, -2, 2}]
$\endgroup$