# Minimizing roots of a transcendental equations [duplicate]

I'm trying to use the solution of FindRoot with parameters for further calculations. Annoyingly enough it always gives me trouble with replacing the parameters. As an example I'm attaching a simple example I've cooked, since the solution is obvious. First I've defined the function "root", which is the solution for the equation, and is obviously (x-1)^2

root[x_] := y /. FindRoot[y - (x - 1)^2, {y, 1}]


Next I've tried to minimize this function, which should obviously return x=1, but I get a string of errors:

FindMinimum[root[x], {x, 2}]

FindRoot::nlnum: The function value {1. -1. (-1.+x)^2} is not a list of numbers with dimensions {1} at {y} = {1.}. >>

ReplaceAll::reps: {FindRoot[y-(x-1)^2,{y,1}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>

FindRoot::nlnum: The function value {1. -1. (-1.+x)^2} is not a list of numbers with dimensions {1} at {y} = {1.}. >>

ReplaceAll::reps: {FindRoot[y-(x-1)^2,{y,1}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>

FindRoot::nlnum: The function value {1. -1. (-1.+x)^2} is not a list of numbers with dimensions {1} at {y} = {1.}. >>

General::stop: Further output of FindRoot::nlnum will be suppressed during this calculation. >>

ReplaceAll::reps: {FindRoot[y-1. (-1.+x)^2,{y,1.}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>

General::stop: Further output of ReplaceAll::reps will be suppressed during this calculation. >>

FindMinimum::lstol: The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >>

Out= {0., {x -> 1.}}


The result comes out right in the end, but obviously something isn't right. Any ideas?