# Find $\frac{dy}{dx}$ if $x\sqrt{1+y}+y\sqrt{1+x}=0$

Find $\frac{dy}{dx}$ if $x\sqrt{1+y}+y\sqrt{1+x}=0$ for $-1\leq x\leq 1$

$$\frac{dy}{dx}=\frac{-1}{(1+x)^2}\text{ if }x\neq y$$

If it was like $y=\sqrt{1+x}$ i think i know how to do it

D[Sqrt[1+x],x]


but how do i differentiate the functions like the one above ?

## 4 Answers

Perhaps not the most optimal method, but you could:

1. Take the total derivative with respect to x
2. Solve for y'[x]
3. Solve the given equation for y
4. Substitute (3) in (2)
5. Simplify, assuming bounds for x given

Simplify[
Solve[Dt[x \[Sqrt](1 + y) + y \[Sqrt](1 + x), x] == 0,
Dt[y, x]] /.
y -> Solve[x \[Sqrt](1 + y) + y \[Sqrt](1 + x) == 0, y][[1, 1, 2]],
Assumptions -> {x >= -1, x <= 1}][[1, 1, 2]]


output:

-(1/(1 + x)^2)


Edit: @Nasser gives the "more optimal" method I suggested in the beginning. I do too much solving and differentiating.

Instead of Differentiating, Solving, Solving, Substituting, and Simplifying (5 steps); why not just Substitute, Solve, Differentiate, and Simplify (4 steps) (Nasser's improvement)? Alternatively (my slight improvement), just Solve, Differentiate, and Simplify (3 steps):

Dt[Solve[x √(1 + y) + y √(1 + x) == 0, y],
x] // Simplify


Out:

{{Dt[y, x] -> -(1/(1 + x)^2)}}


Easier to look at version: It turns out that including the bounds on x are redundant! However, if you wish to include them (again, unnecessary):

Simplify[Dt[Solve[Sqrt[x + 1] y + x Sqrt[y + 1] == 0, y], {x}],
Assumptions -> {x >= -1 && x <= 1}]


Why not just

ClearAll[y,x]
expr = x Sqrt[1+y]+y Sqrt[1+x]==0;
expr = expr/.y->y[x];
D[Solve[expr,y[x]],x]//Simplify I am not sure if this is what the above answer is doing, but I get different output, from each so I thought to post this. If it turns out to be just a extra simplification step is needed, will delete my answer.

Just substitude y->y[x]

First atttempt:

Solve[0 == D[x Sqrt[1 + y[x]] + y[x] Sqrt[1 + x], x], y'[x]][]
(*{Derivative[y][x] -> (Sqrt[1 + y[x]] (y[x] + 2 Sqrt[1 + x] Sqrt[1 + y[x]]))/(Sqrt[1 + x] (-x - 2 Sqrt[1 + x] Sqrt[1 + y[x]]))} *)


Everything is ok but knowledge about y is not included.

Final answer

eq= x \[Sqrt](1 + y[x]) + y[x] \[Sqrt](1 + x);
sol=Solve[{eq==0,D[eq,x]==0},{y[x],y'[x]}];
Simplify[sol,-1<=x<=1][];
(* {y[x] -> -(x/(1 + x)), Derivative[y][x] -> -(1/(1 + x)^2)} *)

• How does that answer the OP's question? – Max Coplan Apr 18 '18 at 20:45
• @MaxCoplan Why not, the OP has not said that the answer should be in terms of x. – yarchik Apr 18 '18 at 21:11
• thnx. but i am trying to get the same simplified answer as i have obtained whn solved myself. – ss1729 Apr 18 '18 at 22:09
• @yarchik That's better now. OP did ask for the answer to be y'=-1/(x+1)^2, which is a function of x. UlrichNeumann now has it in terms of x – Max Coplan Apr 19 '18 at 13:19

The function and its implicit derivative both vanish, so that gives a system of two equations in the two variables {y[x],y'[x]} to solve in terms of x.

expr = x *Sqrt[1 + y] + y*Sqrt[1 + x];
eyx = expr /. y -> y[x];
Simplify[y'[x] /. First[Solve[{D[eyx, x], eyx} == 0, {y[x], y'[x]}]]]

(* Out= (
4 x + 3 x^2 - 4 Sqrt[1/(1 + x)] (1 + x)^(5/2))/((1 + x)^2 (2 + x)^2) *)